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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}

/* ── App shell ────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Sidebar resizer handle ──────────────────────────── */
#sidebar-resizer {
  width: 6px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 50;
  transition: background var(--transition);
  margin-left: -6px;
  margin-right: 0;
}

#sidebar-resizer:hover,
#sidebar-resizer.resizing {
  background: var(--accent);
}

#sidebar-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 2px;
  height: 30px;
  background: var(--border);
  border-radius: 2px;
  transition: background var(--transition);
  pointer-events: none;
}

#sidebar-resizer:hover::after,
#sidebar-resizer.resizing::after {
  background: rgba(255,255,255,0.6);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-brand svg { flex-shrink: 0; }

/* ── Sidebar navigation ───────────────────────────────── */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.nav-item:hover {
  background: var(--bg-cell);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-item svg { flex-shrink: 0; }

/* ── Präsenz-Avatare pro Reiter ───────────────────────── */
.nav-presence {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-left: 8px;
}
.nav-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  margin-left: -6px;
  box-sizing: border-box;
  text-transform: uppercase;
  line-height: 1;
}
.nav-avatar:first-child { margin-left: 0; }
.nav-avatar-more {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

#sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#sidebar-content::-webkit-scrollbar { width: 4px; }
#sidebar-content::-webkit-scrollbar-track { background: transparent; }
#sidebar-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Main area ────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

#main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: 40px;
}

#btn-sidebar-toggle,
#btn-weekend-toggle,
#btn-week-report,
#btn-auto-assign {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  height: auto;
  min-height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

#btn-sidebar-toggle:hover,
#btn-weekend-toggle:hover,
#btn-week-report:hover,
#btn-auto-assign:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

#btn-sidebar-toggle svg,
#btn-weekend-toggle svg,
#btn-week-report svg,
#btn-auto-assign svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* "Aus"-Zustand der Toggle-Buttons → transparent + gedämpft */
#app.weekend-hidden #btn-weekend-toggle,
#app.sidebar-hidden #btn-sidebar-toggle {
  background: transparent;
  color: var(--text-muted);
}

#app.weekend-hidden #btn-weekend-toggle svg,
#app.sidebar-hidden #btn-sidebar-toggle svg {
  opacity: 0.5;
}

/* When sidebar is hidden */
#app.sidebar-hidden #sidebar,
#app.sidebar-hidden #sidebar-resizer {
  display: none;
}

#grid-wrapper {
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#grid-wrapper::-webkit-scrollbar { width: 6px; height: 6px; }
#grid-wrapper::-webkit-scrollbar-track { background: var(--bg-primary); }
#grid-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
#grid-wrapper::-webkit-scrollbar-corner { background: var(--bg-primary); }

/* ── Planning table ───────────────────────────────────── */
.planning-table {
  border-collapse: collapse;
  table-layout: auto;
  width: 100%;
}

.planning-table th,
.planning-table td {
  border: 1px solid var(--border-subtle);
}

/* Sticky header */
.planning-table thead {
  position: sticky;
  top: -1px; /* 1 px Überlappung verhindert Sub-Pixel-Lücke beim Scrollen */
  z-index: 20;
}

/* Sticky-stabile Trennlinien für Header-Zellen.
   Hintergrund: `border-collapse: collapse` lässt die nativen Borders beim
   Sticky-Scrollen oft durchscheinend / unsauber wirken, weil sie auf der
   Zell-Grenze sitzen. Wir zeichnen die Trennlinien zusätzlich via
   box-shadow auf jeder Header-Zelle — diese werden zuverlässig mit dem
   <thead> gerendert und bleiben beim Scrollen deckend sichtbar.
   Die vertikale Trennlinie wird mit 1 px Überlappung zur Nachbarzelle
   gezeichnet (outset statt inset), damit keine Sub-Pixel-Lücke entsteht. */
.planning-table thead th {
  box-shadow:
    1px 0 0 0 var(--border),            /* vertikale Trennung — 1 px außerhalb der Zelle */
    inset 0 -2px 0 0 var(--border);     /* horizontale Trennung zum Body */
}
.planning-table thead th.week-nav-cell {
  box-shadow:
    2px 0 0 0 var(--border),
    inset 0 -2px 0 0 var(--border);
}

.week-nav-cell {
  width: 1%;
  white-space: nowrap;
  background: var(--bg-surface);
  position: sticky;
  left: 0;
  z-index: 30;
  padding: 0 12px;
}

/* Abteilungs-Überschrift bleibt beim horizontalen Scrollen links fixiert
   (wie .machine-info-cell). */
.dept-header-row > td.dept-header-info {
  position: sticky;
  left: 0;
  z-index: 6;
  background: var(--bg-dept);
  white-space: nowrap;
}

.day-header-cell {
  min-width: var(--day-col);
  background: var(--bg-surface);
  text-align: center;
  padding: 8px 6px;
  vertical-align: top;
}

.day-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.day-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.day-header-cell.today {
  background-color: var(--bg-surface);
  background-image: linear-gradient(rgba(82, 168, 82, 0.18), rgba(82, 168, 82, 0.18));
}
.day-header-cell.today .day-name { color: #52a852; }
.day-header-cell.today .day-date { color: #52a852; }

/* Highlight whole "today" column down through all cells */
.drop-zone.today { background: rgba(82, 168, 82, 0.1); }
.drop-zone.today.drag-over { background: var(--accent-dim); }
.drop-zone.today.drop-invalid { background: rgba(224, 82, 82, 0.15); }

/* Holiday column highlighting (red, overrides today-green if both apply) */
.day-header-cell.holiday {
  background-color: var(--bg-surface);
  background-image: linear-gradient(rgba(224, 82, 82, 0.22), rgba(224, 82, 82, 0.22));
}
.day-header-cell.holiday .day-name,
.day-header-cell.holiday .day-date { color: #e05252; }
.day-holiday-name {
  font-size: 9px;
  color: #e05252;
  margin-top: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  justify-content: center;
}

.holiday-icon {
  font-size: 12px;
  filter: saturate(1.2);
}

.drop-zone.holiday { background: rgba(224, 82, 82, 0.12); }
.drop-zone.holiday.drag-over { background: var(--accent-dim); }
.drop-zone.holiday.drop-invalid { background: rgba(224, 82, 82, 0.30); }

/* Department rows */
.dept-header-row > td {
  background: var(--bg-dept);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  border-top: 2px solid var(--border);
  border-left: none;
  border-right: none;
}

/* Per-Tag-Spaltenbeschriftungen in der Abteilungs-Zeile:
   „Mitarbeiter:" über der Schicht-Spalte, „Auftrag:" über der Drop-Zone.
   Bewusst kräftig + heller Kontrast, damit es als Überschrift wirkt. */
.dept-header-row > .dept-header-col-label {
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
}

/* Machine rows */
.machine-info-cell {
  background: var(--bg-elevated);
  padding: 10px 12px;
  vertical-align: middle;
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 2px solid var(--border);
}

.machine-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 5px;
}

.machine-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.employee-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-cell);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 1px 3px 1px 7px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.emp-pill-name {
  line-height: 1.5;
}

.shift-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 100px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: filter var(--transition), background var(--transition), color var(--transition);
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.shift-badge:hover { filter: brightness(1.15); }
.shift-badge.shift-empty:hover { background: var(--bg-elevated); color: var(--text-primary); }
.shift-badge:not(.shift-empty) { border-style: solid; }

/* Shift row variations */
.shift-row .machine-info-cell {
  padding: 8px 12px;
}

.shift-row + .shift-row .machine-info-cell,
.shift-row + .shift-row .drop-zone {
  border-top: 1px dashed var(--border);
}

/* Kräftige Trennung zwischen den Maschinen: eigene Trennzeile mit 8px-Leiste,
   die oben und unten je eine 2px schwarze Kante hat (Mitte = Flächenfarbe).
   Eigene Zeile statt Zell-Border, weil die Tabelle border-collapse nutzt. */
.machine-sep-row td {
  padding: 0;
  height: 4px;            /* + 2px Ober- + 2px Unterkante = 8px Gesamt */
  background: var(--bg-surface);
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
  border-left: none;
  border-right: none;
}

/* Vertikale Trennspalte zwischen zwei Wochentagen: gleiche Optik wie die
   horizontale Maschinen-Trennleiste (8px breit = 4px Mitte + 2px schwarze
   Kanten links/rechts). Eigene Spalte statt Zell-Border wegen border-collapse. */
.planning-table .day-sep-col {
  width: 4px;
  min-width: 4px;
  max-width: 4px;
  padding: 0;
  background: var(--bg-surface);
  border-left: 2px solid #000;
  border-right: 2px solid #000;
  border-top: none;
  border-bottom: none;
}

.shift-row-label {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 100px;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-left: auto;
}

.machine-name-spacer {
  flex: 1;
  min-width: 0;
}

.shift-row-F .machine-info-cell { box-shadow: inset 3px 0 0 #52a852; }
.shift-row-S .machine-info-cell { box-shadow: inset 3px 0 0 #e67e22; }
.shift-row-N .machine-info-cell { box-shadow: inset 3px 0 0 #6c5ce7; }

/* ── Schicht-Spalte (zwischen Maschine und Wochentagen) ── */
.shift-col-header {
  width: 90px;
  min-width: 90px;
  background: var(--bg-surface);
  border-bottom: 2px solid var(--border);
  border-right: 2px solid var(--border);
  text-align: center;
  padding: 8px 6px;
  vertical-align: middle;
}

.shift-col-header-text {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
}

.shift-col-cell {
  width: 90px;
  min-width: 90px;
  background: var(--bg-elevated);
  text-align: center;
  vertical-align: middle;
  padding: 8px 6px;
  border-right: 2px solid var(--border);
}

.shift-col-cell-empty { background: var(--bg-cell); }

.shift-col-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
}

.empty-shift-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.machine-hint-cell {
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
  background: var(--bg-cell);
}

/* Sidebar options (bottom) */
.sidebar-options {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.option-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.option-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.option-checkbox:hover { color: var(--text-primary); }

/* Durch „Nur Belegungen anzeigen" gesperrte Optionen: ausgegraut + durchgestrichen */
.option-checkbox.is-locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.option-checkbox.is-locked:hover { color: var(--text-secondary); }
.option-checkbox.is-locked span { text-decoration: line-through; }
.option-checkbox input:disabled { cursor: not-allowed; }

/* Bulk-Toggle-Gruppe oben in der Mitarbeiterverwaltung */
.mgmt-bulk-toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-cell);
}

.btn-bulk {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* Drop zone */
.drop-zone {
  background: var(--bg-cell);
  vertical-align: top;
  padding: 5px;
  min-height: 82px;
}

/* ── Schmale Schicht-Spalte pro Tag (Mitarbeiter) ──────── */
.shift-day-header-cell {
  width: 1%;
  min-width: 60px;
  background: var(--bg-surface);
  text-align: center;
  padding: 4px 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.shift-day-header-text {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.shift-day-cell {
  width: 1%;
  min-width: 60px;
  background: var(--bg-elevated);
  padding: 6px 8px;
  vertical-align: middle;
  text-align: center;
  border-right: 1px solid var(--border-subtle);
  font-size: 10px;
  white-space: nowrap;
}

.shift-day-cell-F { box-shadow: inset 3px 0 0 #52a852; }
.shift-day-cell-S { box-shadow: inset 3px 0 0 #e67e22; }
.shift-day-cell-N { box-shadow: inset 3px 0 0 #6c5ce7; }

.shift-day-cell-off {
  background: var(--bg-cell);
  opacity: 0.6;
}

/* Spalten-weite Farbgebung: today (grün) und holiday (rot) */
.shift-day-cell.today { background: rgba(82, 168, 82, 0.18); }
.shift-day-header-cell.today {
  background-color: var(--bg-surface);
  background-image: linear-gradient(rgba(82, 168, 82, 0.18), rgba(82, 168, 82, 0.18));
}

.shift-day-cell.holiday { background: rgba(224, 82, 82, 0.22); }
.shift-day-header-cell.holiday {
  background-color: var(--bg-surface);
  background-image: linear-gradient(rgba(224, 82, 82, 0.22), rgba(224, 82, 82, 0.22));
}

/* holiday hat Priorität über today */
.shift-day-cell.today.holiday { background: rgba(224, 82, 82, 0.28); }
.shift-day-header-cell.today.holiday {
  background-color: var(--bg-surface);
  background-image: linear-gradient(rgba(224, 82, 82, 0.28), rgba(224, 82, 82, 0.28));
}

/* "off"-Status (Wochenende/Feiertag, keine Mitarbeiter eingeplant) bleibt zusätzlich gedimmt,
   aber die holiday-Farbe darf trotzdem durchschlagen */
.shift-day-cell-off.holiday {
  opacity: 1;
  background: rgba(224, 82, 82, 0.22);
}

.shift-day-name {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  padding: 2px 4px;
  line-height: 1.3;
}

.shift-day-emp-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  cursor: grab;
  user-select: none;
}

.shift-day-emp-block.dragging-source {
  opacity: 0.4;
  cursor: grabbing;
}

.shift-day-emp-block + .shift-day-emp-block {
  border-top: 1px dashed var(--border-subtle);
  margin-top: 2px;
}

.shift-day-absent {
  color: var(--text-muted);
  text-decoration: line-through;
  opacity: 0.75;
}

.shift-day-icon {
  margin-right: 3px;
  font-size: 11px;
  display: inline-block;
}

.shift-day-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 11px;
  display: block;
  margin-bottom: 4px;
}

/* Leere Werktags-Zelle (kein Mitarbeiter zugeteilt): deutlich erkennbar
   durch dezente diagonale Schraffur + „FREI"-Label. Besetzte Zellen
   bleiben unverändert → klarer Kontrast. Off-Zellen (Wochenende/Feiertag)
   bekommen diese Markierung NICHT (kein .is-free). */
.shift-day-cell.is-free {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(230, 170, 60, 0.13) 0, rgba(230, 170, 60, 0.13) 5px,
    transparent 5px, transparent 11px
  );
}
.shift-day-free {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Remove-Button für Mitarbeiter-Block */
.shift-day-emp-block {
  position: relative;
}

.shift-day-emp-remove {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  background: rgba(224, 82, 82, 0.85);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.shift-day-emp-block:hover .shift-day-emp-remove {
  display: inline-flex;
}

/* Drop-Target Highlight */
.shift-day-cell.drag-over {
  background: var(--accent-dim);
  outline: 2px dashed rgba(79, 142, 247, 0.5);
  outline-offset: -2px;
}

/* Drag-Ghost für Mitarbeiter */
.employee-drag-ghost {
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  transform: rotate(-2deg);
}

/* Maschinen-Schicht-Label im Info-Cell */
.machine-shift-label {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: auto;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
}

.shift-day-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  max-width: calc(100% - 4px);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border: 2px solid #000;
  border-radius: 100px;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
}

.shift-day-label-icon {
  font-size: 10px;
  -webkit-text-stroke: 0;
  flex-shrink: 0;
}

/* Abwesenheits-Label: skalierbar mit längeren Texten – kein UPPERCASE, kleineres Font */
.shift-day-label-absent {
  text-transform: none;
  letter-spacing: 0;
  font-size: 9px;
  padding: 2px 6px;
  background: var(--danger);
  -webkit-text-stroke: 1px #000;
}

.shift-day-label.absence-urlaub       { background: #4f8ef7; }
.shift-day-label.absence-krank        { background: #e05252; }
.shift-day-label.absence-sonder       { background: #e0952a; }
.shift-day-label.absence-berufsschule { background: #6c5ce7; }
.shift-day-label.absence-schulung     { background: #00bcd4; }
.shift-day-label.absence-kurzarbeit   { background: #6b7494; }

/* Prioritäts-Pille im Mitarbeiter-Block (unter der Schicht-Pille) */
.shift-day-prio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 4px);
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border: 2px solid #000;
  border-radius: 100px;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
}
.shift-day-prio:hover { filter: brightness(1.15); }
.shift-day-prio.is-empty {
  opacity: 0.55;
  -webkit-text-stroke: 0;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 260px;
    --day-col: 120px;
    --machine-col: 170px;
  }
}

@media (max-width: 600px) {
  :root { --sidebar-width: 220px; }
}

/* ── Mobile / Smartphone ──────────────────────────────────
   Reine Darstellungs-Optimierung. Greift nur ≤768px; oberhalb
   bleibt das Desktop-Layout unverändert. Kein Eingriff in die
   Drag&Drop-Logik (Planen per Ziehen bleibt Desktop-only). */

/* Backdrop standardmäßig (Desktop) ausgeblendet */
#sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  /* Sidebar als Off-Canvas-Schublade über dem Inhalt */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 320px);
    z-index: 200;
    transform: translateX(0);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }
  /* Desktop-Hide (display:none) überschreiben → animierte Schublade */
  #app.sidebar-hidden #sidebar {
    display: flex;
    transform: translateX(-100%);
  }
  /* Resizer auf Touch sinnlos */
  #sidebar-resizer,
  #app.sidebar-hidden #sidebar-resizer {
    display: none;
  }

  /* Backdrop nur bei offener Schublade */
  #app:not(.sidebar-hidden) #sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
  }

  /* Kompaktere Rasterspalten + Touch-Scroll */
  :root {
    --day-col: 130px;
  }
  #grid-wrapper { -webkit-overflow-scrolling: touch; }

  /* Header kompakter */
  #main-header { gap: 6px; padding: 6px 8px; }
  #btn-sidebar-toggle,
  #btn-weekend-toggle,
  #btn-week-report,
  #btn-auto-assign {
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
  }

  /* Modals mobil */
  #modal-overlay { padding: 10px; }
  #modal-dialog {
    max-width: 100%;
    max-height: 95vh;
  }
}

/* ── Touch-Feinheiten (Geräte ohne Hover) ─────────────────
   Hover-only-Bedienelemente sichtbar machen (Tippen löst Klick
   nativ aus) und Tap-Targets vergrößern. */
@media (hover: none) and (pointer: coarse) {
  .shift-day-emp-block .shift-day-emp-remove { display: inline-flex; }

  .shift-badge,
  .shift-day-prio,
  .shift-day-label {
    min-height: 28px;
  }
}

/* ── Smartphone-Vergrößerungen (Klasse via JS, siehe index.html) ──
   An html.is-phone gebunden statt an einen Media-Query, da die
   50%-Skalierung die logische Breite je nach Gerät über den
   Breakpoint hebt und (hover:none)/(pointer:coarse) im Test-Setup
   nicht immer matcht. Greift exakt dann, wenn auch skaliert wird;
   Desktop erhält die Klasse nie. */

/* 1) Checkboxen in der Sidebar doppelt so groß (14px → 28px) */
html.is-phone #sidebar input[type="checkbox"] {
  width: 28px;
  height: 28px;
}

/* 2) Header-Buttons (Sidebar, Wochenende, Abmelden) vergrößert
      (30% + erneut 30%) */
html.is-phone #btn-sidebar-toggle,
html.is-phone #btn-weekend-toggle,
html.is-phone #btn-week-report,
html.is-phone #btn-auto-assign {
  min-height: 51px;
  padding: 10px 23px;
  font-size: 22px;
  gap: 13px;
}
html.is-phone #btn-sidebar-toggle svg,
html.is-phone #btn-weekend-toggle svg,
html.is-phone #btn-week-report svg,
html.is-phone #btn-auto-assign svg {
  width: 30px;
  height: 30px;
}
html.is-phone #btn-logout {
  padding: 7px 13px;
  font-size: 18px;
}

/* 3) Größerer vertikaler Abstand zwischen den Checkbox-Optionen unten
      in der Sidebar (bessere Trefferfläche auf dem Smartphone) */
html.is-phone .sidebar-options {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
html.is-phone .sidebar-options .option-checkbox {
  padding: 4px 0;
}
