/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --header-h: 68px;
  --filter-h: 38px;
  --col-name-w: 152px;
  --col-dept-w: 76px;
  --col-stat-w: 56px;
  --col-day-w:  36px;
  --col-day-we-w: 22px;
  --row-h:      26px;
  --header-row-h: 42px;
  --hdr-label-h:  22px;
  --left-name:  0px;
  --left-dept:  152px;
  --left-stat1: 228px;
  --left-stat2: 284px;
  --left-stat3: 340px;
  --left-stat4: 396px;

  --bg:           #f1f3f6;
  --surface:      #ffffff;
  --border:       #dde1e9;
  --border-light: #e8eaef;
  --text:         #1a1f2e;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;
  --primary:      #1e3a5f;
  --primary-hover:#162e4d;
  --primary-light:#e8eef7;
  --danger:       #c0392b;
  --weekend-bg:   #f0f1f5;
  --weekend-hdr:  #e8eaf2;
  --holiday-bg:   #fef9ec;
  --today-bg:     #eef4ff;
  --shadow:    0 1px 4px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── App container ── */
#app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Header ── */
#header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  z-index: 100;
}

.header-left  { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.app-logo { height: 46px; object-fit: contain; flex-shrink: 0; }
.hdr-sep  { width: 1px; height: 24px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.app-title { font-size: 20px; font-weight: 700; letter-spacing: .02em; color: var(--text); white-space: nowrap; }
.year-badge { background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 12px; letter-spacing: .03em; }

.header-nav   { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center; }
.nav-btn { background: none; border: 1px solid var(--border); border-radius: 5px; width: 28px; height: 28px; font-size: 16px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: all .15s; }
.nav-btn:hover { background: var(--bg); color: var(--text); border-color: #c0c6d4; }
.month-label { font-size: 14px; font-weight: 600; min-width: 140px; text-align: center; color: var(--text); }

.header-right { display: flex; align-items: center; gap: 5px; margin-left: auto; }

.btn { padding: 5px 12px; border-radius: 5px; border: 1px solid transparent; font-size: 12px; font-weight: 500; cursor: pointer; transition: all .15s; white-space: nowrap; letter-spacing: .01em; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text); border-color: #c0c6d4; }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #a93226; }
.btn-sm        { padding: 3px 9px; font-size: 11px; }
.hdr-divider { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }

.save-indicator { font-size: 10px; color: #22c55e; opacity: 0; transition: opacity .3s; user-select: none; min-width: 90px; }
.save-indicator.saving { color: #f59e0b; opacity: 1; }
.save-indicator.saved  { color: #22c55e; opacity: 1; }

/* ── Filter Bar ── */
#filter-bar {
  height: var(--filter-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 8px;
  flex-shrink: 0;
  overflow: visible;
  z-index: 150;
  position: relative;
}
#filter-bar::-webkit-scrollbar { height: 0; }

.filter-label { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; text-transform: uppercase; letter-spacing: .05em; }

#dept-buttons { display: flex; gap: 5px; flex-wrap: nowrap; }

.dept-btn {
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-muted);
  transition: all .15s;
}
.dept-btn:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.dept-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Calendar Wrapper ── */
#calendar-wrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#calendar-container {
  flex: 1;
  min-height: 0;
  overflow: auto;   /* sole scroll container — sticky works relative to this */
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: fit-content;
  margin: 0;
}

/* ── Grid (table layout) ── */
#grid { display: table; border-collapse: collapse; min-width: 100%; }
.grid-row { display: table-row; }
.grid-row.emp-row:hover .cell-name,
.grid-row.emp-row:hover .cell-dept,
.grid-row.emp-row:hover .cell-stat { background-color: #f8faff !important; }
.grid-row.drag-over .cell-name,
.grid-row.drag-over .cell-dept,
.grid-row.drag-over .cell-stat,
.grid-row.drag-over .cell-shift { background: #dbeafe !important; }

/* ── All cells base ── */
.cell-name, .cell-dept, .cell-stat, .cell-day-header, .cell-shift {
  display: table-cell;
  border: 1px solid var(--border-light);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Name column — sticky */
.cell-name {
  position: sticky;
  left: var(--left-name);
  z-index: 10;
  width: var(--col-name-w); min-width: var(--col-name-w); max-width: var(--col-name-w);
  height: var(--row-h);
  padding: 0 8px;
  font-weight: 500;
  font-size: 12px;
  background: var(--surface);
  border-right: 2px solid var(--border);
  vertical-align: middle;
}
/* Header row 1: month title + day numbers */
.header-row--month .cell-name { height: var(--header-row-h); font-size: 15px; font-weight: 700; background: #f7f8fa; cursor: default; border-right: 2px solid var(--border); border-bottom: 1px solid var(--border-light); top: 0; z-index: 46; vertical-align: middle; text-align: center; letter-spacing: .01em; }
/* Header row 2: column labels */
.header-row--labels .cell-name { height: var(--hdr-label-h); font-weight: 600; font-size: 11px; color: var(--text); background: #eef2ff; cursor: default; border-right: 2px solid var(--border); border-bottom: 2px solid var(--border); top: var(--header-row-h); z-index: 46; vertical-align: middle; text-align: center; }

/* Dept column — sticky */
.cell-dept {
  position: sticky;
  left: var(--left-dept);
  z-index: 10;
  width: var(--col-dept-w); min-width: var(--col-dept-w); max-width: var(--col-dept-w);
  padding: 0 5px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border-right: 1px solid var(--border-light);
}
.header-row--month .cell-dept  { height: var(--header-row-h); font-size: 14px; font-weight: 700; color: var(--text); background: #f7f8fa; border-bottom: 1px solid var(--border-light); top: 0; z-index: 45; text-align: center; letter-spacing: .01em; }
.header-row--labels .cell-dept { height: var(--hdr-label-h);  font-weight: 700; font-size: 11px; color: var(--text); background: #eef2ff; border-bottom: 2px solid var(--border); top: var(--header-row-h); z-index: 45; vertical-align: middle; }

/* Stat columns */
.cell-stat {
  z-index: 10;
  width: var(--col-stat-w); min-width: var(--col-stat-w);
  text-align: center;
  padding: 0 3px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface);
}
/* Sticky-Positioning NUR für Header-Cells. Body-Cells bleiben statisch:
   - Chrome berechnet auf display:table-cell+position:sticky ein implizites top
     (~148px = header-h+filter-h+header-row-h), unabhängig davon welchen Wert
     CSS setzt (auto, -99999px → wird geclampt). Das führt dazu, dass die obersten
     Body-Stat-Cells alle bei demselben Sticky-Punkt stapeln und sich gegenseitig
     verdecken (verschwinden bei voller Höhe, erscheinen beim Verkleinern).
   - Trade-off: Stat-Spalte scrollt beim horizontalen Scrollen mit (nicht mehr
     sticky-left). Für die Tagesansicht-Übersicht akzeptabel, da man die Stats
     nur am Anfang anschaut. */
.header-row--month .cell-stat,
.header-row--labels .cell-stat { position: sticky; }
.header-row--month .cell-stat.s1,
.header-row--labels .cell-stat.s1 { left: var(--left-stat1); }
.header-row--month .cell-stat.s2,
.header-row--labels .cell-stat.s2 { left: var(--left-stat2); }
.header-row--month .cell-stat.s3,
.header-row--labels .cell-stat.s3 { left: var(--left-stat3); }
.cell-stat.s1 { left: var(--left-stat1); }
.cell-stat.s2 { left: var(--left-stat2); }
.cell-stat.s3 { left: var(--left-stat3); }
.cell-stat.s4 { left: var(--left-stat4); }
.header-row--month .cell-stat.s4,
.header-row--labels .cell-stat.s4 { left: var(--left-stat4); }

.header-row--month .cell-stat  { height: var(--header-row-h); background: #f7f8fa; border-bottom: 1px solid var(--border-light); top: 0; z-index: 44; }
.header-row--labels .cell-stat { height: var(--hdr-label-h);  font-weight: 700; font-size: 11px; color: var(--text); background: #eef2ff; border-bottom: 2px solid var(--border); top: var(--header-row-h); z-index: 44; vertical-align: middle; text-align: center; }

.stat-vac  { color: #d97706; }
.stat-sick { color: #dc2626; }
.stat-work { color: #059669; }
.stat-neg  { color: #dc2626; font-weight: 700; }

/* Day header */
.cell-day-header {
  width: var(--col-day-w); min-width: var(--col-day-w);
  text-align: center;
  padding: 4px 1px;
  height: var(--header-row-h);
  vertical-align: top;
  background: #f7f8fa;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 30;
}
.cell-day-header.weekend {
  background: var(--weekend-hdr);
  width: var(--col-day-we-w); min-width: var(--col-day-we-w);
}
.cell-day-header.weekend .day-num { color: #6b7280; }
.cell-day-header.holiday { background: #fff3e0; }
.cell-day-header.today {
  background: #dc2626;
  width: calc(var(--col-day-w) + 16px);
  min-width: calc(var(--col-day-w) + 16px);
  box-shadow: inset 2px 0 0 #991b1b, inset -2px 0 0 #991b1b;
  z-index: 31;
}
.cell-day-header.today .day-num  { color: #fff; font-size: 17px; }
.cell-day-header.today .day-name { color: rgba(255,255,255,.85); font-size: 11px; }
.cell-day-header.today .week-num { color: rgba(255,255,255,.6); }

.day-num  { display: block; font-size: 13px; font-weight: 700; line-height: 1.4; }
.day-name { display: block; font-size: 10px; color: var(--text-muted); line-height: 1.2; }
.week-num { display: block; font-size: 9px; color: var(--text-light); line-height: 1.1; }
.holiday-dot { display: block; font-size: 8px; color: #f97316; }

/* Shift cells */
.cell-shift {
  width: var(--col-day-w); min-width: var(--col-day-w);
  height: var(--row-h);
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  letter-spacing: .02em;
  transition: opacity .1s;
}
.cell-shift:hover { opacity: .78; outline: 2px solid var(--primary); outline-offset: -2px; position: relative; z-index: 3; }

/* Weekend shift cells — diagonal stripe overlay */
.cell-shift.weekend:not([style*="background"]) {
  background: repeating-linear-gradient(
    135deg,
    var(--weekend-bg) 0px,
    var(--weekend-bg) 4px,
    #dde0ea 4px,
    #dde0ea 8px
  ) !important;
}
/* Weekend with shift code: tint the shift color darker */
.cell-shift.weekend { filter: brightness(0.9); width: var(--col-day-we-w); min-width: var(--col-day-we-w); }
.cell-shift.weekend:hover { filter: brightness(0.8); }

.cell-shift.holiday { background: var(--holiday-bg); }
.cell-shift.today {
  /* wider column = magnifier effect */
  width: calc(var(--col-day-w) + 16px);
  min-width: calc(var(--col-day-w) + 16px);
  /* red border rails */
  box-shadow: inset 2px 0 0 #dc2626, inset -2px 0 0 #dc2626,
              inset 0 0 0 9999px rgba(220, 38, 38, 0.22);
  /* ^^ red glass tint over shift colors */
  font-size: 11px;
  position: relative; z-index: 2;
}

/* Name cell inner layout */
.cell-name-inner { display: flex; align-items: center; }

/* Employee order buttons (▲/▼) */
.emp-order-btns { display: flex; flex-direction: column; gap: 0; margin-right: 4px; flex-shrink: 0; opacity: 0; transition: opacity .15s; }
.emp-row:hover .emp-order-btns { opacity: 0.6; }
.order-btn { background: none; border: none; padding: 0; cursor: pointer; font-size: 7px; line-height: 1; color: var(--text-muted); width: 10px; height: 9px; display: flex; align-items: center; justify-content: center; }
.order-btn:hover { color: var(--primary); opacity: 1; }

/* ── Modals ── */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(2px); }
.modal-box { position: relative; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 360px; max-width: 92vw; max-height: 90vh; overflow: auto; animation: modal-in .15s ease; }
@keyframes modal-in { from { opacity: 0; transform: scale(.96) translateY(-6px); } to { opacity: 1; transform: none; } }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-light); font-weight: 600; font-size: 14px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border-light); }
.modal-close  { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 14px; width: 26px; height: 26px; border-radius: 5px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg); color: var(--text); }

/* Shift picker */
.shift-box { min-width: 420px; }
.shift-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 14px; }
.shift-btn { padding: 7px 3px; border: none; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 700; text-align: center; transition: transform .1s; line-height: 1.3; }
.shift-btn:hover { transform: scale(1.06); }
.shift-btn .shift-code  { display: block; font-size: 13px; font-weight: 800; }
.shift-btn .shift-label { display: block; font-size: 9px; opacity: .85; }
.shift-actions { display: flex; gap: 8px; padding: 0 14px 14px; justify-content: flex-end; }

/* Shift Editor */
.color-modal-box { min-width: 780px; max-width: 95vw; }
.se-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border-light); background: var(--bg); }
.se-hint { font-size: 11px; color: var(--text-light); }
.se-table-wrap { max-height: 60vh; overflow-y: auto; padding: 0; }
.se-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.se-table thead th { position: sticky; top: 0; background: #f7f8fa; padding: 8px 10px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap; z-index: 1; }
.se-table tbody tr { border-bottom: 1px solid var(--border-light); }
.se-table tbody tr:hover { background: #fafbfc; }
.se-table td { padding: 7px 8px; vertical-align: middle; }

/* Code badge (readonly) */
.se-code-badge { display: inline-block; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
/* Code input (new rows) */
.se-code-input { width: 72px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.se-code-input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* Label input */
.se-label-input { width: 140px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; }
.se-label-input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* Color picker */
.se-color-wrap { display: flex; align-items: center; gap: 6px; }
.se-color-preview { width: 28px; height: 22px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); flex-shrink: 0; cursor: pointer; }
.se-bg-input { width: 36px; height: 26px; padding: 0 2px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }

/* FG toggle */
.se-fg-toggle { display: flex; gap: 2px; }
.se-fg-btn { width: 28px; height: 24px; border: 1px solid var(--border); border-radius: 4px; font-weight: 800; font-size: 13px; cursor: pointer; opacity: 0.4; transition: opacity .15s; }
.se-fg-btn.active { opacity: 1; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* Department pills */
.se-dept-pills { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.dept-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 500; cursor: pointer; background: var(--border-light); color: var(--text-muted); border: 1px solid var(--border); transition: all .15s; white-space: nowrap; }
.dept-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dept-pill:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* Row action buttons */
.se-reset-btn { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 3px 8px; font-size: 13px; cursor: pointer; color: var(--text-muted); }
.se-reset-btn:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }
.se-delete-btn { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 3px 8px; font-size: 13px; cursor: pointer; color: var(--danger); }
.se-delete-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Employee name + title in grid */
/* Default (filter active): name on top, title below */
.emp-name-wrap { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.emp-name      { font-weight: 500; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-title     { font-size: 10px; color: var(--text-muted); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }

/* Compact: name and title side by side on one line */
#grid.density-compact .emp-name-wrap { flex-direction: row; align-items: center; gap: 5px; }
#grid.density-compact .emp-title { font-size: 10px; }

/* Employee editor modal */
.emp-modal-box  { min-width: 360px; }
.emp-edit-body  { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.emp-edit-row   { display: flex; flex-direction: column; gap: 4px; }
.emp-edit-row label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.emp-edit-input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; width: 100%; }
.emp-edit-input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.emp-color-preview { width: 32px; height: 32px; border-radius: 6px; border: 2px solid rgba(0,0,0,.12); }

/* Backup list */
.backup-list { padding: 10px; max-height: 400px; overflow-y: auto; }
.backup-item { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; border-radius: 7px; border: 1px solid var(--border-light); margin-bottom: 5px; }
.backup-item:hover { background: var(--bg); }
.backup-name { font-size: 13px; font-weight: 500; }
.backup-size { font-size: 11px; color: var(--text-muted); }
.backup-actions { display: flex; gap: 5px; }

/* Stats modal */
.stats-modal-box { min-width: 750px; }
.stats-select { margin-left: 5px; padding: 3px 6px; border-radius: 4px; border: 1px solid var(--border); font-size: 12px; }
.stats-content { padding: 16px; overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.stats-table th { background: #f7f8fa; padding: 7px 9px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap; }
.stats-table td { padding: 6px 9px; border-bottom: 1px solid var(--border-light); white-space: nowrap; }
.stats-table tr:hover td { background: var(--bg); }
.stats-bar-wrap { background: var(--border-light); border-radius: 4px; height: 7px; width: 80px; overflow: hidden; display: inline-block; vertical-align: middle; }
.stats-bar { height: 100%; border-radius: 4px; }
.shift-chip { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 10px; font-weight: 700; margin: 1px; }

/* Import modal */
.import-body { padding: 18px; }
.import-body p { margin-bottom: 10px; color: var(--text-muted); font-size: 13px; }
.warning-text { color: #d97706; }
.file-label { display: inline-block; padding: 7px 13px; background: var(--bg); border: 2px dashed var(--border); border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.file-label:hover { border-color: var(--primary); color: var(--primary); }
.file-label input[type="file"] { display: none; }
.import-filename { font-size: 12px; color: var(--primary); font-weight: 500; margin-bottom: 10px; }
.import-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.import-status { margin-top: 8px; font-size: 12px; }
.import-status.ok  { color: #059669; }
.import-status.err { color: var(--danger); }

/* ── Undo/Redo buttons ── */
.btn-icon { padding: 4px 9px; font-size: 15px; line-height: 1; min-width: 32px; }
.btn-icon:disabled { opacity: .35; cursor: default; }

/* ── Auth buttons ── */
.btn-auth       { background: var(--primary); color: #fff; border-color: var(--primary); font-size: 11px; padding: 4px 10px; }
.btn-auth:hover { background: var(--primary-hover); }
.btn-auth-guest { background: transparent; color: var(--text-muted); border-color: var(--border); font-size: 11px; padding: 4px 10px; }
.btn-auth-guest:hover { background: var(--bg); color: var(--text); }

/* ── Requests button ── */
.btn-requests-btn { background: transparent; color: var(--text-muted); border-color: var(--border); font-size: 11px; padding: 4px 10px; position: relative; }
.btn-requests-btn:hover { background: var(--bg); color: var(--text); }

/* ── User display widget ── */
.user-display { display: flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--primary-light); font-size: 11px; color: var(--primary); font-weight: 500; }
.user-display-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-edit-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 12px; padding: 0 2px; line-height: 1; }
.user-edit-btn:hover { color: var(--primary); }
.requests-badge { display: inline-flex; align-items: center; justify-content: center; background: #ef4444; color: #fff; border-radius: 9px; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 4px; vertical-align: middle; }

/* ── Read-only banner ── */
.readonly-banner { background: #f8f9fa; border-bottom: 1px solid var(--border-light); color: var(--text-muted); font-size: 12px; padding: 5px 20px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.readonly-login-link { margin-left: auto; color: var(--primary); cursor: pointer; font-weight: 500; text-decoration: none; }
.readonly-login-link:hover { text-decoration: underline; }
.read-only-grid .cell-shift { cursor: default !important; }

/* ── Login modal ── */
.login-box  { min-width: 320px; max-width: 380px; }
.login-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.login-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.login-error { color: var(--danger); font-size: 12px; min-height: 16px; }

/* ── Change Request modal ── */
.cr-box  { min-width: 480px; max-width: 560px; }
.cr-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cr-info-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--border-light); }
.cr-label { color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; min-width: 80px; }
.cr-section-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing:.04em; margin-top: 6px; }
.cr-shift-grid { max-height: 180px; overflow-y: auto; }
.cr-shift-btn.cr-selected { outline: 3px solid #1d4ed8 !important; outline-offset: -2px; }
.cr-status { font-size: 12px; min-height: 16px; }
.cr-status.ok  { color: #059669; }
.cr-status.err { color: var(--danger); }

/* ── Admin Requests modal ── */
.requests-box  { min-width: 560px; max-width: 700px; }
.requests-list { padding: 12px; max-height: 520px; overflow-y: auto; }
.req-section-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing:.05em; padding: 4px 0 8px; }
.req-section-title--approved { color: #15803d; }
.req-section-title--rejected { color: #b91c1c; }
.req-item { border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; margin-bottom: 8px; background: var(--surface); }
.req-item.req-approved { border-color: #bbf7d0; background: #f0fdf4; }
.req-item.req-rejected { border-color: #fecaca; background: #fff5f5; opacity: .75; }
.req-header { display: flex; align-items: baseline; gap: 6px; font-size: 13px; margin-bottom: 6px; }
.req-date { margin-left: auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.req-shift-change { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.req-comment { font-size: 11px; color: var(--text-muted); font-style: italic; }
.req-actions { margin-top: 8px; display: flex; gap: 6px; }
.req-decided { margin-top: 6px; font-size: 11px; font-weight: 600; }
.req-decided.req-approved { color: #059669; }
.req-decided.req-rejected { color: var(--danger); }

/* ── Multi-cell selection ── */
.cell-shift.selected {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}
.cell-shift { user-select: none; cursor: pointer; }

/* ── Overflow days (adjacent month) ── */
.cell-day-header.overflow { opacity: .45; }
.cell-shift.overflow      { opacity: .5; }
.cell-day-header.overflow .day-num { color: var(--text-muted); }

/* ── Inaktive Tage (vor Eintritt / nach Austritt) ── */
.cell-shift.inactive-day {
  background: repeating-linear-gradient(-45deg, #e2e8f0 0 4px, #edf2f7 4px 8px) !important;
  cursor: not-allowed !important;
  opacity: .7;
}

/* ── Pensum / Teilzeit ──────────────────────────────────────────────────────
   .freeday      = Werktag mit 0 Soll-Stunden (Teilzeit-Frei). Gesperrt, aber per
                   Rechtsklick oeffenbar. Bewusst ANDERE Schraffur-Richtung als
                   .inactive-day (Ein-/Austritt), damit die beiden Sperrgruende
                   im Grid auseinanderzuhalten sind.
   .parttime-day = reduzierter Tag (>0, aber unter Vollzeit-Tagessoll).
                   Kleiner Keil unten rechts; die Stundenzahl steht im Tooltip. */
.cell-shift.freeday {
  /* Schraffur = „laut Pensum frei", KEINE Sperre. Der Code bleibt lesbar, denn
     Arbeitskuerzel duerfen hier gesetzt werden (Vorarbeit / Ueberstunden). */
  background: repeating-linear-gradient(45deg, #dbe4ee 0 3px, #f2f6fa 3px 7px) !important;
  opacity: .8;
}
/* Arbeitskuerzel auf einem freien Tag = Mehrarbeit: volle Deckkraft + blauer Rahmen */
.cell-shift.freeday.freeday-worked {
  opacity: 1;
  box-shadow: inset 0 0 0 2px #0369a1;
  font-weight: 700;
}
/* Anteiliger Tag (Halbtag & Co.): die Zelle ist diagonal geteilt — der Verlauf
   wird in applyDayCellCode() gesetzt. Das Kuerzel bekommt einen eigenen Traeger,
   damit es auch auf der weissen Haelfte lesbar bleibt. */
.cell-shift.halfday {
  position: relative;
  border: 1px solid rgba(15, 23, 42, .18);
}
.cell-code-chip {
  display: inline-block;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .78);
  color: #1f2937;
  font-weight: 700;
  line-height: 1.35;
}
.cell-shift.halfday.freeday-worked .cell-code-chip { background: rgba(255, 255, 255, .9); }

/* ── Mehrarbeit in der Zelle ─────────────────────────────────────────────────
   Die Monatsansicht ist die PLANUNGSansicht und traegt KEINE Zahlen (siehe
   Abschnitt ZIELBILD in CLAUDE.md). Am 08.09.2026 standen hier kurzzeitig ein
   Kapazitaetsbalken und danach eine Stundenzahl unter dem Kuerzel — beides vom
   User verworfen: der Balken war nicht ablesbar, die Zahl stand an jedem Tag
   jedes Teilzeit-MA und sagte an fast allen nichts Neues.

   Es bleiben zwei stille Signale, jedes fuer GENAU EINE Frage:
     .halfday   Diagonale = der Tag war fuer DIESEN MA angeschnitten (Ist < Soll)
     .overtime  Rahmen    = mehr gearbeitet als vereinbart (Ist > Soll)
   Die Stundenzahlen stehen im Tooltip.
   RESERVIERT: die Ecke oben rechts gehoert dem spaeteren Stempelabgleich
   (.stamp-diff). Kein anderes Feature belegt sie. */
.cell-shift.overtime { box-shadow: inset 0 0 0 2px #0369a1; opacity: 1; font-weight: 700; }

/* Gegenstueck zu .overtime: an diesem Tag WENIGER als vereinbart (Halbtag, frueher
   weg). Braucht ein eigenes Zeichen, weil die Diagonale den Anteil an einem
   VOLLZEIT-Tag zeigt — Lauras normaler Tag ist dort dauerhaft halbiert, und ohne
   diese Kante waere ihr echter Halbtag davon nicht zu unterscheiden.
   Blau = mehr als vereinbart, Bernstein = weniger. */
.cell-shift.shortday { box-shadow: inset 0 -3px 0 #d97706; }

/* ── Auswertung: Zeitraum-Umschalter (16.09.2026) ───────────────────────────
   „Aktuell" schneidet alles nach heute weg. Ohne diesen Schnitt blaehen im
   Dezember eingetragene Ferien die Jahreszahl auf und man sieht nicht, was
   bis jetzt tatsaechlich bezogen wurde. */
.stats-scope { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.stats-scope button {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 11px; border: 0; background: var(--surface); color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
}
.stats-scope button + button { border-left: 1px solid var(--border); }
.stats-scope button:hover { background: var(--primary-light); color: var(--text); }
.stats-scope button.is-active { background: #0284c7; color: #fff; }
.stats-scope button:focus-visible { outline: 2px solid #0284c7; outline-offset: -2px; }

.stats-csv-btn {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 6px 11px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
}
.stats-csv-btn:hover { border-color: #0284c7; color: #0284c7; }
.stats-csv-btn:focus-visible { outline: 2px solid #0284c7; outline-offset: 2px; }

.stats-period {
  font-size: 12px; color: var(--text-muted);
  padding: 8px 10px; margin-bottom: 8px;
  background: var(--primary-light); border-radius: 6px;
}
.stats-period b { color: var(--text); }

/* ── Selection popup ── */
.sel-popup-box {
  width: 320px;
  padding-bottom: 0;
}
.sel-popup-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 8px;
}
.sel-popup-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 9px 14px;
  font-size: 13px;
}

/* ── Repeat section in shift modal ── */
.repeat-section {
  padding: 10px 16px 6px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}
.repeat-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.repeat-options {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.repeat-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.repeat-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.repeat-until-row {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Selected shift button (before confirm) ── */
.shift-btn.shift-selected {
  outline: 3px solid #fff;
  outline-offset: -3px;
  box-shadow: 0 0 0 4px #2563eb, 0 2px 8px rgba(0,0,0,.25);
  transform: scale(1.06);
  z-index: 1;
  position: relative;
}

/* ── Keyboard shortcut input (capturing state) ── */
.shortcut-input.capturing {
  background: #fffbe6;
  border-color: #f59e0b;
  color: #92400e;
}

/* ── Weekend toggle ── */
#btn-toggle-weekends { flex-shrink: 0; }
#btn-toggle-weekends.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
#btn-toggle-absent { flex-shrink: 0; }
#btn-toggle-absent.active { background: #d97706; color: #fff; border-color: #d97706; }

/* ── Stat column toggles (admin-only) ── */
.stat-col-toggles { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }
.stat-toggle-btn {
  opacity: .45;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.stat-toggle-btn.active { opacity: 1; background: var(--primary); color: #fff; border-color: var(--primary); }
.stat-toggle-btn:hover  { opacity: 1; }

/* ── View density buttons ── */
.view-density-btns { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }
.density-btn {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.density-btn:hover  { background: var(--bg); color: var(--text); border-color: #c0c6d4; }
.density-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Weekends hidden ── */
.weekends-hidden .cell-day-header.weekend,
.weekends-hidden .cell-shift.weekend { display: none; }

/* ── View density: Mittel ── */
#grid.density-medium {
  --row-h: 26px;
  --header-row-h: 40px;
  --col-day-w: 30px;
  --col-day-we-w: 17px;
}
#grid.density-medium .day-num   { font-size: 11px; }
#grid.density-medium .day-name  { font-size: 9px; }
#grid.density-medium .week-num  { font-size: 8px; }
#grid.density-medium .cell-shift { font-size: 9px; }
#grid.density-medium .cell-name  { font-size: 11px; }
#grid.density-medium .cell-stat  { font-size: 10px; }
#grid.density-medium .emp-title  { font-size: 9px; }

/* ── View density: Kompakt ── */
#grid.density-compact {
  --row-h: 20px;
  --header-row-h: 28px;
  --col-day-w: 22px;
  --col-day-we-w: 12px;
}
#grid.density-compact .cell-name { height: var(--row-h) !important; padding-top: 0; padding-bottom: 0; }
#grid.density-compact .day-name  { display: none; }
#grid.density-compact .week-num  { display: none; }
#grid.density-compact .day-num   { font-size: 9px; line-height: var(--header-row-h); }
#grid.density-compact .cell-shift { font-size: 9px; }
#grid.density-compact .cell-name  { font-size: 10px; }
#grid.density-compact .cell-dept  { font-size: 9px; }
#grid.density-compact .cell-stat  { font-size: 9px; }
#grid.density-compact .emp-title  { font-size: 10px; color: var(--text-muted); }

/* ── Update Popup v2 ── */
.update-box {
  width: 460px; padding: 0; overflow: hidden; border-radius: 16px;
  animation: update-modal-in .45s cubic-bezier(.34,1.56,.64,1) !important;
}
@keyframes update-modal-in {
  from { opacity: 0; transform: scale(.72) translateY(24px); }
  to   { opacity: 1; transform: none; }
}
.update-hero {
  background: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%);
  padding: 36px 28px 28px; text-align: center; position: relative; overflow: hidden;
}
.update-hero::before {
  content: ''; position: absolute; top: -50px; right: -50px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.update-hero::after {
  content: ''; position: absolute; bottom: -30px; left: -40px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,.05);
}
/* Sparkles */
.update-hero-sparkles { position: absolute; inset: 0; pointer-events: none; }
.sparkle {
  position: absolute; color: rgba(255,255,255,.5); font-size: 12px;
  animation: sparkle-float 3s ease-in-out infinite;
}
.s1 { top: 18%; left: 12%; animation-delay: 0s;    animation-duration: 2.8s; font-size: 10px; }
.s2 { top: 25%; right: 14%; animation-delay: .7s;  animation-duration: 3.2s; font-size: 14px; }
.s3 { bottom: 22%; left: 18%; animation-delay: 1.2s; animation-duration: 2.5s; }
.s4 { bottom: 18%; right: 10%; animation-delay: .4s;  animation-duration: 3.5s; font-size: 8px; }
@keyframes sparkle-float {
  0%, 100% { transform: translateY(0) scale(1); opacity: .5; }
  50%       { transform: translateY(-8px) scale(1.3); opacity: 1; }
}
.update-hero-icon {
  font-size: 52px; display: block; margin-bottom: 14px; position: relative; z-index: 1;
  animation: rocket-fly 1.8s ease-in-out infinite alternate;
}
@keyframes rocket-fly {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-10px) rotate(5deg); }
}
.update-hero-headline {
  font-size: 24px; font-weight: 800; color: #fff; margin: 0 0 8px;
  letter-spacing: -.02em; position: relative; z-index: 1;
}
.update-hero-sub {
  font-size: 13px; color: rgba(255,255,255,.72); margin: 0 0 16px;
  position: relative; z-index: 1;
}
.update-version-pill {
  display: inline-block; background: rgba(255,255,255,.2); color: #fff;
  font-size: 12px; font-weight: 700; padding: 4px 16px; border-radius: 999px;
  letter-spacing: .05em; backdrop-filter: blur(4px); position: relative; z-index: 1;
}
/* Body */
.update-body { padding: 20px 22px 6px; }
.update-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 10px;
}
.update-changelog {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  max-height: 280px; overflow-y: auto;
}
.update-changelog li {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; color: var(--text); line-height: 1.45;
  background: var(--bg); border-radius: 8px; padding: 8px 11px;
  opacity: 0; animation: cl-item-in .35s ease forwards;
}
.update-changelog li::before {
  content: '✦'; color: #7c3aed; font-size: 9px; margin-top: 3px; flex-shrink: 0;
}
@keyframes cl-item-in {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: none; }
}
/* Footer */
.update-footer { display: flex; justify-content: flex-end; padding: 14px 22px 20px; }
.btn-update-ok {
  background: linear-gradient(135deg, #1a56db, #7c3aed);
  color: #fff; border: none; border-radius: 9px;
  padding: 10px 28px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity .15s, transform .12s;
  box-shadow: 0 4px 14px rgba(124,58,237,.4);
}
.btn-update-ok:hover { opacity: .92; transform: scale(1.03); }

/* ── Toast ── */
.toast { position: fixed; bottom: 22px; right: 22px; background: #1f2937; color: #fff; padding: 9px 16px; border-radius: 7px; font-size: 13px; z-index: 2000; box-shadow: var(--shadow-lg); animation: toast-in .2s ease; }
.toast.hidden  { display: none; }
.toast.success { background: #059669; }
.toast.error   { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Settings tabs ── */
.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 16px;
}
.settings-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
  transition: color .15s, border-color .15s;
}
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.settings-tab:hover  { color: var(--primary); }

/* ── iCloud settings panel ── */
.icloud-panel { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.icloud-header { display: flex; align-items: center; gap: 14px; padding-bottom: 4px; }
.icloud-icon { font-size: 32px; line-height: 1; }
.icloud-title { font-size: 15px; font-weight: 700; color: var(--text); }
.icloud-sub   { font-size: 12px; color: var(--text-muted); }
.icloud-hint-link { font-size: 11px; color: var(--primary); text-decoration: none; margin-left: 8px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.icloud-hint-link:hover { text-decoration: underline; }
.icloud-actions { display: flex; gap: 8px; }
.icloud-status { font-size: 13px; padding: 9px 12px; border-radius: 7px; }
.icloud-status.ok    { background: #d1fae5; color: #065f46; }
.icloud-status.error { background: #fee2e2; color: #991b1b; }
.icloud-section-label { font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: .04em; text-transform: uppercase; padding-bottom: 2px; border-bottom: 1px solid var(--border-light); }
.icloud-section-hint  { font-size: 11px; font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.icloud-divider { border-top: 1px solid var(--border-light); }
.icloud-sync-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icloud-sync-title { font-size: 13px; font-weight: 600; color: var(--text); }
.icloud-sync-sub   { font-size: 11px; color: var(--text-muted); }
.icloud-info-box { background: var(--bg); border-radius: 8px; padding: 10px 13px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.icloud-info-box code { background: rgba(0,0,0,.06); border-radius: 3px; padding: 1px 4px; font-size: 11px; }

/* ── Email settings panel ── */
.email-settings-content {
  padding: 14px 16px;
  overflow-y: auto;
  max-height: 440px;
}
.email-section-title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin: 8px 0 10px;
}
.email-tpl-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.email-tpl-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 8px;
}
.email-tpl-textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  font-size: 12px;
}
.email-tpl-hint {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── Test-Version (helle Ansicht, nur rotes Banner) ── */
body.test-version #header { border-bottom: 3px solid #c0392b; }
.test-version-badge { background: #c0392b; color: #fff; font-size: 10px; font-weight: 800; padding: 3px 10px; border-radius: 4px; letter-spacing: .05em; margin-left: 8px; animation: pulse-red 2s infinite; }
@keyframes pulse-red { 0%,100% { opacity: 1; } 50% { opacity: .7; } }

/* ── Dept Filter Dropdown ── */
.dept-filter-dropdown { position: absolute; top: calc(100% + 4px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-lg); z-index: 200; min-width: 180px; padding: 6px 0; }
.dept-filter-option { display: flex; align-items: center; gap: 8px; padding: 5px 12px; cursor: pointer; font-size: 12px; }
.dept-filter-option:hover { background: var(--bg); }
.dept-filter-option input[type=checkbox] { cursor: pointer; }
.dept-filter-actions { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); margin-top: 4px; }

/* ── Dept Group Separator ── */
.emp-row.dept-group-start { border-top: 3px solid var(--primary); margin-top: 2px; }
.emp-row.dept-group-start .cell-name,
.emp-row.dept-group-start .cell-dept,
.emp-row.dept-group-start .cell-stat,
.emp-row.dept-group-start .cell-shift { border-top: 3px solid var(--primary); }
.grid-row.dept-label-row { display: flex; height: 20px; width: 100%; }
.dept-group-label { display: flex; align-items: center; height: 20px; font-size: 12px; font-weight: 700; letter-spacing: .06em; padding: 0 12px; white-space: nowrap; flex: 1; }
#grid.density-compact .dept-group-label { font-size: 10px; height: 18px; }

/* ── Multi CR Preview ── */
.mcr-changes-preview { max-height: 120px; overflow-y: auto; background: var(--bg); border-radius: 5px; padding: 6px 10px; margin-bottom: 10px; font-size: 11px; color: var(--text-muted); }
.mcr-changes-preview div { padding: 2px 0; }

/* ── Request list multi-change ── */
.req-changes-list { margin: 4px 0 6px; }
.req-change-row { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 0; flex-wrap: wrap; }
.req-change-emp { font-weight: 600; color: var(--text); min-width: 90px; }
.req-change-date { color: var(--text-muted); font-size: 11px; margin-right: 4px; }

/* ── Sub-dept checkboxes in emp editor ── */
.emp-subdepts-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.subdept-checkbox-label { display: flex; align-items: center; gap: 5px; font-size: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 3px 9px; cursor: pointer; user-select: none; }
.subdept-checkbox-label:hover { border-color: var(--primary); }
.subdept-checkbox-label input[type=checkbox] { cursor: pointer; }

/* ── Day View ── */
#day-view-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
#dv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #fff;
  flex-shrink: 0;
  min-height: 46px;
}
#dv-date-label { font-size: 15px; font-weight: 700; color: #fff; margin: 0 6px; }
#dv-header .nav-btn { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 6px; padding: 4px 12px; font-size: 18px; cursor: pointer; transition: background .15s; }
#dv-header .nav-btn:hover { background: rgba(255,255,255,.28); }
#dv-header .btn-secondary { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); color: #fff; }
#dv-header .btn-secondary:hover { background: rgba(255,255,255,.28); }
#dv-grid { flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; padding: 0; background: #dde3ea; }
#dv-controls { padding: 7px 12px; background: #fff; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.dv-controls-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.dv-dept-toggle { padding: 4px 12px; border-radius: 20px; border: 2px solid var(--dtc, #2563eb); background: var(--dtc, #2563eb); color: var(--dtfg, #fff); font-size: 11px; font-weight: 700; cursor: pointer; letter-spacing: .04em; text-transform: uppercase; transition: opacity .15s; }
.dv-dept-toggle--off { opacity: .28; }
.dv-dept-toggle:hover { opacity: .75; }
.dv-dept-add { padding: 4px 12px; border-radius: 20px; border: 2px dashed #94a3b8; background: transparent; color: #64748b; font-size: 12px; font-weight: 700; cursor: pointer; transition: all .15s; letter-spacing: .03em; }
.dv-dept-add:hover { border-color: #1e3a5f; color: #1e3a5f; background: #e8eef7; }
/* Farb-Picker Swatch (Toggle-Button) */
.dv-dept-color-swatch { display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.65); margin-left: 4px; vertical-align: middle; position: relative; cursor: pointer; flex-shrink: 0; background: var(--sc, #888); }
.dv-dept-color-swatch input[type=color] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: none; }
/* Farb-Picker auf Karten-Header */
.dv-header-color-input { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); cursor: pointer; padding: 0; opacity: 0.35; background: transparent; transition: opacity .15s; }
.dv-dept-card-header:hover .dv-header-color-input { opacity: 0.85; }
/* Farb-Picker auf Monats-Label */
.dept-label-row { position: relative; }
.dept-label-color-input { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); cursor: pointer; padding: 0; opacity: 0.35; background: transparent; transition: opacity .15s; }
.dept-label-row:hover .dept-label-color-input { opacity: 0.85; }
.dv-func-option--future { background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.dv-func-option--future:hover { background: #dbeafe; }
.dv-add-dept-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1100; }
.dv-add-dept-box { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 340px; max-width: 95vw; overflow: hidden; }

/* ── Settings modal ─────────────────────────────────────────────────────────── */
.dv-settings-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; z-index: 1200; overflow-y: auto; padding: 32px 12px; }
.dv-settings-box { background: #fff; border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.3); width: 600px; max-width: 98vw; overflow: hidden; }
.dv-settings-header { padding: 18px 20px 14px; background: #1e3a5f; color: #fff; display: flex; align-items: center; justify-content: space-between; }
.dv-settings-header h2 { font-size: 18px; font-weight: 900; margin: 0; letter-spacing: .04em; }
.dv-settings-close { background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 20px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dv-settings-close:hover { background: rgba(255,255,255,.3); }
.dv-settings-tabs { display: flex; border-bottom: 2px solid #e2e8f0; background: #f8fafc; }
.dv-settings-tab { padding: 10px 20px; font-size: 13px; font-weight: 700; color: #64748b; border: none; background: none; cursor: pointer; letter-spacing: .03em; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s; }
.dv-settings-tab.active { color: #1e3a5f; border-bottom-color: #1e3a5f; }
.dv-settings-tab:hover:not(.active) { color: #1e3a5f; background: #eff6ff; }
.dv-settings-pane { padding: 18px 20px; display: none; max-height: 70vh; overflow-y: auto; }
.dv-settings-pane.active { display: block; }
/* Color tab */
.dv-settings-color-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.dv-settings-color-swatch { width: 32px; height: 32px; border-radius: 8px; border: 2px solid rgba(0,0,0,.1); cursor: pointer; flex-shrink: 0; position: relative; overflow: hidden; }
.dv-settings-color-swatch input[type=color] { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); opacity: 0; cursor: pointer; }
.dv-settings-color-label { flex: 1; font-size: 14px; font-weight: 600; color: #1e293b; }
/* Scale tab */
.dv-settings-scale-row { padding: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.dv-settings-scale-row label { font-size: 13px; font-weight: 700; color: #475569; }
.dv-settings-scale-row input[type=range] { width: 100%; accent-color: #1e3a5f; }
.dv-settings-scale-val { font-size: 16px; font-weight: 900; color: #1e3a5f; min-width: 50px; text-align: right; }
/* Functions tab */
.dv-func-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.dv-func-color-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(0,0,0,.1); cursor: pointer; flex-shrink: 0; position: relative; overflow: hidden; }
.dv-func-color-dot input[type=color] { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); opacity: 0; cursor: pointer; }
.dv-func-inputs { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.dv-func-input { padding: 5px 8px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; width: 100%; box-sizing: border-box; }
.dv-func-input-short { width: 80px !important; }
.dv-func-icon-zone { width: 52px; height: 52px; border-radius: 8px; border: 2px dashed #cbd5e1; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; overflow: hidden; position: relative; transition: border-color .15s; background: #f8fafc; }
.dv-func-icon-zone:hover, .dv-func-icon-zone.dragover { border-color: #1e3a5f; background: #eff6ff; }
.dv-func-icon-zone img { width: 100%; height: 100%; object-fit: contain; }
.dv-func-icon-zone .dv-func-icon-hint { font-size: 9px; color: #94a3b8; text-align: center; line-height: 1.4; pointer-events: none; }
.dv-func-icon-size { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.dv-func-icon-size button { width: 24px; height: 24px; border-radius: 6px; border: 1px solid #e2e8f0; background: #f8fafc; font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #475569; }
.dv-func-icon-size button:hover { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.dv-func-icon-size-val { font-size: 11px; font-weight: 700; color: #64748b; min-width: 30px; text-align: center; }
.dv-func-del { background: none; border: none; color: #94a3b8; font-size: 18px; cursor: pointer; padding: 4px; border-radius: 4px; transition: color .12s; }
.dv-func-del:hover { color: #dc2626; background: #fee2e2; }
.dv-settings-add-btn { margin-top: 12px; padding: 8px 18px; border-radius: 20px; border: 2px dashed #94a3b8; background: transparent; color: #64748b; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s; }
.dv-settings-add-btn:hover { border-color: #1e3a5f; color: #1e3a5f; background: #e8eef7; }
/* Function save button */
.dv-func-save-btn { padding: 8px 18px; border-radius: 10px; border: none; background: #1e3a5f; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s; }
.dv-func-save-btn:hover { background: #2d5a9e; }
/* Icon position picker (3×3 grid) */
.dv-icon-pos-grid { display: grid; grid-template-columns: repeat(3,20px); grid-template-rows: repeat(3,20px); gap: 2px; flex-shrink: 0; }
.dv-icon-pos-cell { width: 20px; height: 20px; border-radius: 3px; border: 1.5px solid #e2e8f0; cursor: pointer; background: #f8fafc; transition: all .12s; }
.dv-icon-pos-cell:hover { background: #dbeafe; border-color: #93c5fd; }
.dv-icon-pos-cell.active { background: #1e3a5f; border-color: #1e3a5f; }
/* Offset sliders for icon position */
.dv-icon-offset-row { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; min-width: 90px; }
.dv-icon-offset-row label { font-size: 9px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; }
.dv-icon-offset-row input[type=range] { width: 100%; height: 4px; accent-color: #1e3a5f; cursor: pointer; }
.dv-icon-offset-val { font-size: 10px; color: #475569; font-weight: 600; text-align: right; }
/* Schedule code input in function row */
.dv-func-input-code { width: 70px !important; font-family: monospace; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
/* Settings gear button */
.dv-settings-btn { padding: 4px 12px; border-radius: 20px; border: 2px solid #94a3b8; background: #f8fafc; color: #475569; font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: .03em; display: flex; align-items: center; gap: 5px; transition: all .15s; margin-left: auto; }
.dv-settings-btn:hover { border-color: #1e3a5f; color: #1e3a5f; background: #e8eef7; }
/* Inline color picker popup on dblclick of card header */
.dv-hdr-color-pop { position: fixed; z-index: 1300; background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.22); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 200px; }
.dv-hdr-color-pop label { font-size: 12px; font-weight: 700; color: #475569; }
.dv-hdr-color-pop input[type=color] { width: 100%; height: 36px; border: none; border-radius: 6px; cursor: pointer; padding: 0; }

/* ── Dept cards layout ────────────────────────────────────────────────────── */
.dv-cards-area { display: flex; flex-wrap: nowrap; gap: 10px; padding: 14px; align-items: stretch; justify-content: center; box-sizing: border-box; height: 100%; min-width: max-content; background: #f0f4f8; }
/* Card wrapper: holds the card + resize handle */
.dv-card-wrap { position: relative; display: flex; flex-direction: row; min-width: 0; height: 100%; }
/* Each card: 3-row internal grid → header 56px | fix grows | support fixed 120px */
.dv-dept-card { display: grid; grid-template-rows: 56px 1fr min-content; border-radius: 14px; overflow: visible; box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06); border: 1px solid #e2e8f0; background: #fff; min-width: 0; height: 100%; flex: 1 1 100%; }
/* Resize handle on right edge of card wrapper */
.dv-card-resize-handle { position: absolute; right: -5px; top: 8%; bottom: 8%; width: 10px; cursor: col-resize; z-index: 15; display: flex; align-items: center; justify-content: center; }
.dv-card-resize-handle::after { content: ''; display: block; width: 4px; height: 40px; border-radius: 2px; background: rgba(30,58,95,.18); transition: background .15s, height .15s; }
.dv-card-resize-handle:hover::after, .dv-card-resize-handle.active::after { background: rgba(30,58,95,.55); height: 60px; }
.dv-dept-card-header { position: relative; display: flex; align-items: center; justify-content: center; height: 56px; font-size: 17px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; gap: 8px; overflow: hidden; border-radius: 14px 14px 0 0; }
.dv-dept-card-section { padding: 14px 10px 10px; overflow-y: auto; overflow-x: visible; transition: background .12s, outline .12s; }
.dv-dept-card-section.dv-drop-over { background: #eff6ff !important; outline: 2px dashed #3b82f6; outline-offset: -3px; }
.dv-dept-card-header.dv-drop-over { outline: 2px dashed rgba(255,255,255,.7); outline-offset: -3px; }
.dv-dept-card-section-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #64748b; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid #cbd5e1; }
.dv-dept-card-section--support { border-top: 3px solid #94a3b8; background: #f1f5f9; }

/* Rank groups — CSS grid, columns driven by --chip-cols on parent section */
.dv-rank-group { display: grid; grid-template-columns: repeat(var(--chip-cols, 1), minmax(148px, 1fr)); gap: 6px; align-content: start; overflow: visible; padding-top: 10px; }
.dv-rank-group + .dv-rank-group { border-top: 1px dashed #e2e8f0; padding-top: 14px; margin-top: 4px; }

/* ── Employee chips ───────────────────────────────────────────────────────── */
.dv-chip { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px 30px 10px 13px; background: #fff; border: 1px solid #e8edf4; border-left: 5px solid #94a3b8; border-radius: 10px; min-width: 145px; min-height: 74px; cursor: grab; box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 3px 10px rgba(0,0,0,.06); transition: box-shadow .15s, transform .12s; user-select: none; overflow: visible; }
/* Name row (inline RedBull + name) */
.dv-chip-name-row { display: flex; align-items: center; gap: 5px; }
.dv-chip::before { content: ''; position: absolute; top: 0; left: 4px; right: 0; height: 3px; background: var(--chip-accent, #94a3b8); border-radius: 0 8px 0 0; opacity: .7; }
.dv-chip:hover { box-shadow: 0 4px 16px rgba(0,0,0,.14), 0 1px 4px rgba(0,0,0,.08); transform: translateY(-2px); }
.dv-chip--leader { min-width: 195px; min-height: 112px; border-color: rgba(220,38,38,.35); box-shadow: 0 3px 14px rgba(220,38,38,.2); padding-right: 38px; }
.dv-chip--dragging { opacity: .35; transform: scale(.94); }
.dv-chip-name { font-size: 16px; font-weight: 700; color: #1e293b; line-height: 1.2; }
.dv-chip-sub { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1; margin-top: 4px; letter-spacing: .03em; padding: 2px 7px; border-radius: 20px; background: color-mix(in srgb, currentColor 12%, transparent); align-self: flex-start; color: #94a3b8; }
.dv-chip-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; color: #fff; align-self: flex-start; letter-spacing: .04em; margin-top: 3px; }
.dv-chip-remove { position: absolute; top: 5px; right: 5px; background: none; border: none; color: #94a3b8; font-size: 15px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: color .12s, background .12s; }
.dv-chip-remove:hover { color: #dc2626; background: #fee2e2; }

/* Section separators (Raupen / Spätschicht) */
.dv-section-sep { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #64748b; border-bottom: 2px solid #cbd5e1; padding-bottom: 5px; margin-top: 10px; margin-bottom: 8px; }

/* Support section (bottom of each card) */
.dv-dept-card-section--support { min-height: 56px; background: #f1f5f9; }
.dv-dept-card-section--support .dv-dept-card-section-title { color: #475569; border-bottom-color: #94a3b8; }
.dv-chip--support { border-style: dashed; border-left-style: solid; min-height: 52px !important; min-width: 148px; padding: 7px 30px 6px 11px; gap: 2px; }
/* Support chips side by side */
.dv-dept-card-section--support .dv-rank-group { display: flex; flex-direction: row; flex-wrap: wrap; gap: 5px; align-content: start; }
.dv-chip--support .dv-chip-name { font-size: 13px; font-weight: 700; }
.dv-chip--support::before { height: 2px; opacity: .45; }
.dv-chip-support-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.dv-chip-from { font-size: 9px; color: #64748b; font-weight: 700; letter-spacing: .02em; margin-top: 1px; }
.dv-chip-hours { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; background: #dbeafe; color: #1d4ed8; cursor: pointer; align-self: flex-start; margin-top: 3px; transition: background .12s; user-select: none; }
.dv-chip-hours:hover { background: #bfdbfe; }
.dv-chip-hours--empty { background: #fef3c7; color: #92400e; }

/* ── Härterei: Drei Sub-Segmente in der H-Karte (Vakuum / Salzbad / Codere) ── */
/* Codere ist zuunterst. Karte ist nur ca. 10% höher als andere — alle Karten in der Reihe wachsen via align-items: stretch mit. */
.dv-dept-card-section--haerterei {
  padding: 6px 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 130px;       /* nur ca. 10% mehr als Standard-Karten */
  overflow-y: auto;
  overflow-x: visible;
}
/* Kompakte Sub-Segmente: jedes nimmt seinen Content-Platz, kleines Minimum für Drop-Target-Sichtbarkeit.
   Drei Segmente mit eigenem Look: Vakuum=Blau (kühl), Codere=Gelb (neutral), Salzbad=Orange (heiß). */
.dv-haerterei-seg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 6px 5px;
  border-radius: 6px;
  border: 1.5px solid;
  border-left-width: 4px;
  min-height: 36px;
  flex: 0 0 auto;
  transition: background .12s, outline .12s;
}
.dv-haerterei-seg[data-segment="vakuum"]  { background: #eff6ff; border-color: #bfdbfe; border-left-color: #2563eb; }
.dv-haerterei-seg[data-segment="codere"]  { background: #fefce8; border-color: #fde68a; border-left-color: #ca8a04; }
.dv-haerterei-seg[data-segment="salzbad"] { background: #fff7ed; border-color: #fed7aa; border-left-color: #ea580c; }
.dv-haerterei-seg.dv-drop-over { outline: 2px dashed #16a34a; outline-offset: -2px; }
.dv-haerterei-seg-title {
  font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
  padding: 0 3px 2px;
  border-bottom: 1px solid;
  flex: 0 0 auto;
}
.dv-haerterei-seg[data-segment="vakuum"]  .dv-haerterei-seg-title { color: #1e40af; border-bottom-color: #bfdbfe; }
.dv-haerterei-seg[data-segment="codere"]  .dv-haerterei-seg-title { color: #854d0e; border-bottom-color: #fde68a; }
.dv-haerterei-seg[data-segment="salzbad"] .dv-haerterei-seg-title { color: #9a3412; border-bottom-color: #fed7aa; }
.dv-haerterei-seg-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}
/* %-Pill am Härterei-Chip (nur bei <100% Anteil sichtbar) */
.dv-chip-segpill { display: inline-block; align-self: flex-start; margin-top: 3px; padding: 2px 8px; border-radius: 12px; font-size: 10px; font-weight: 800; background: #dcfce7; color: #15803d; letter-spacing: .03em; user-select: none; cursor: pointer; }
.dv-chip-segpill:hover { background: #bbf7d0; }
/* Voll-Editor + Single-Input Layout-Hilfen */
.dv-haerterei-split-row { display: flex; align-items: center; padding: 8px 16px; gap: 8px; }
.dv-haerterei-split-sum { padding: 10px 16px; font-size: 14px; }

/* Hours popover additions */
.dv-hours-presets { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 6px; }
.dv-hours-preset { padding: 10px 18px; border-radius: 18px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 700; color: var(--text); transition: all .12s; min-width: 56px; }
.dv-hours-preset:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.dv-hours-preset.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dv-hours-custom-row { display: flex; gap: 8px; padding: 6px 14px 10px; align-items: center; }
.dv-hours-input { width: 90px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 15px; }
/* Generelle Vergrösserung der Bedien-Buttons in Day-View-Popups */
.dv-func-popover .dv-func-option { padding: 11px 14px; font-size: 14px; }
.dv-func-popover .btn-sm { padding: 9px 16px; font-size: 14px; }

/* Pool chips (floating circles) */
@keyframes dvFloat { 0%{transform:translateY(0)} 50%{transform:translateY(-5px)} 100%{transform:translateY(0)} }
.dv-pool-chip { --pool-color: var(--primary); position: relative; width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--pool-color), color-mix(in srgb, var(--pool-color) 60%, #000)); color: #fff; display: flex; align-items: center; justify-content: center; cursor: grab; user-select: none; box-shadow: 0 3px 12px color-mix(in srgb, var(--pool-color) 50%, transparent); animation: dvFloat 3s ease-in-out infinite; transition: width .22s cubic-bezier(.34,1.56,.64,1), height .22s cubic-bezier(.34,1.56,.64,1), border-radius .22s; flex-shrink: 0; overflow: hidden; }
.dv-pool-chip:nth-child(2n) { animation-delay: -.8s; }
.dv-pool-chip:nth-child(3n) { animation-delay: -1.5s; }
.dv-pool-chip:nth-child(4n) { animation-delay: -2.2s; }
.dv-pool-init { font-size: 14px; font-weight: 800; letter-spacing: .02em; transition: opacity .15s; pointer-events: none; }
.dv-pool-info { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; opacity: 0; transition: opacity .15s; padding: 4px 8px; pointer-events: none; }
.dv-pool-name { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.2; }
.dv-pool-meta { font-size: 9px; font-weight: 600; opacity: .8; white-space: nowrap; }
.dv-pool-chip--expanded { width: 150px; height: 52px; border-radius: 26px; animation: none !important; box-shadow: 0 6px 20px color-mix(in srgb, var(--pool-color) 55%, transparent); }
.dv-pool-chip--expanded .dv-pool-init { opacity: 0; }
.dv-pool-chip--expanded .dv-pool-info { opacity: 1; }
.dv-pool-chip--dragging { opacity: .4; animation: none; }

/* Spätschicht – dunkles Sternhimmel-Panel */
.dv-nacht-section { margin-top: 6px; border-radius: 10px; padding: 8px; background: radial-gradient(ellipse at 20% 30%, #1e3a5f 0%, #0f172a 100%); position: relative; overflow: hidden; }
.dv-nacht-section::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,.7) 0%, transparent 100%), radial-gradient(1px 1px at 40% 55%, rgba(255,255,255,.5) 0%, transparent 100%), radial-gradient(1.5px 1.5px at 65% 15%, rgba(255,255,255,.8) 0%, transparent 100%), radial-gradient(1px 1px at 80% 70%, rgba(255,255,255,.5) 0%, transparent 100%), radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,.6) 0%, transparent 100%), radial-gradient(1.5px 1.5px at 55% 40%, rgba(255,255,255,.7) 0%, transparent 100%), radial-gradient(1px 1px at 90% 35%, rgba(255,255,255,.5) 0%, transparent 100%), radial-gradient(1px 1px at 10% 60%, rgba(255,255,255,.6) 0%, transparent 100%), radial-gradient(1px 1px at 72% 85%, rgba(255,255,255,.4) 0%, transparent 100%), radial-gradient(1px 1px at 48% 92%, rgba(255,255,255,.5) 0%, transparent 100%); pointer-events: none; }
.dv-section-sep--nacht { font-size: 13px; color: #bfdbfe; border-bottom-color: rgba(147,197,253,.35); }
.dv-nacht-section .dv-chip { background: rgba(255,255,255,.95); border-color: rgba(255,255,255,.3); }
.dv-nacht-section .dv-rank-group { position: relative; z-index: 1; }

/* Spätschicht (QN) chip dark styling */
.dv-chip--nacht { background: #1e293b !important; border-color: rgba(147,197,253,.25) !important; min-height: 86px; padding-right: 44px; }
.dv-chip--nacht .dv-chip-name { color: #f1f5f9; }
.dv-chip--nacht .dv-chip-sub, .dv-chip--nacht .dv-chip-from { color: #94a3b8; }
.dv-chip--nacht .dv-chip-remove { color: #475569; }
.dv-chip--nacht .dv-chip-remove:hover { color: #fca5a5; background: rgba(220,38,38,.2); }

/* RedBull – now inline left of name */
.dv-chip-redbull { display: inline-block; flex-shrink: 0; width: 20px; height: auto; pointer-events: none; object-fit: contain; border-radius: 2px; vertical-align: middle; }
/* Boss (AV) icon – positioned absolutely, can overflow chip */
.dv-chip-boss { position: absolute; top: 3px; right: 24px; width: 62px; height: 76px; pointer-events: none; display: block; object-fit: contain; }
/* Custom positioned icons (from function settings) */
.dv-chip-func-icon { position: absolute; pointer-events: none; object-fit: contain; border-radius: 3px; }

/* Bottom bar */
#dv-bottom-bar { display: grid; grid-template-columns: 2fr 1fr 1fr; border-top: 2px solid var(--border); background: #f8fafc; flex-shrink: 0; min-height: 110px; max-height: 170px; }
#dv-pool-section, #dv-sick-section, #dv-absent-section { padding: 8px 10px; overflow-y: auto; border-right: 1px solid var(--border); }
#dv-absent-section { border-right: none; }
.dv-bar-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); margin-bottom: 6px; }
.dv-pool-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 4px; border-radius: 8px; transition: background .12s; }
.dv-pool-chips.dv-drop-over { background: #eff6ff; outline: 2px dashed #60a5fa; outline-offset: -2px; }
.dv-bar-list { display: flex; flex-wrap: wrap; gap: 5px; }
.dv-bar-chip { padding: 4px 10px; border-radius: 20px; font-size: 14px; font-weight: 500; cursor: default; }
.dv-bar-chip--sick   { background: #fee2e2; color: #991b1b; cursor: pointer; }
.dv-bar-chip--absent { background: #fef3c7; color: #92400e; }

/* Function / Sick-Slot Popover */
.dv-func-popover { position: fixed; z-index: 9999; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 280px; max-width: 340px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.dv-func-popover-title { font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 6px 10px 8px; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; }
.dv-func-option { display: block; width: 100%; text-align: left; padding: 8px 12px; border: none; border-left: 4px solid transparent; border-radius: 6px; background: none; cursor: pointer; font-size: 13px; color: var(--text); transition: background .12s; }
.dv-func-option:hover  { background: var(--bg); }
.dv-func-option.active { background: var(--primary-light); font-weight: 600; }
.dv-func-option--close { color: var(--text-muted); font-size: 12px; margin-top: 4px; border-top: 1px solid var(--border-light); padding-top: 8px; }

/* ── Grid Month Navigation (Test only) ──────────────────────────────────── */
.grid-corner-wrap  { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; white-space: normal; text-align: center; }
.grid-corner-top   { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 2px; }
.grid-corner-nav   {
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  font-size: 20px; font-weight: 700; line-height: 1; padding: 0 3px;
  color: var(--primary, #2563eb);
}
.grid-corner-nav:hover { color: var(--primary-dark, #1d4ed8); }
.grid-corner-month {
  font-size: 10px; font-weight: 400; color: var(--text-muted); line-height: 1.3; margin-top: 2px;
}
.grid-corner-month-big {
  font-size: 16px; font-weight: 700; color: var(--text, #111827); line-height: 1.15; text-align: center; padding: 0 4px;
  letter-spacing: .01em;
}
.grid-corner-year { color: var(--text-muted, #6b7280); font-weight: 600; margin-left: 3px; }
.grid-corner-name-lbl {
  font-size: 10px; font-weight: 500; color: var(--text-muted); margin-top: 2px; letter-spacing: .03em;
}

/* Kalender-Toolbar (oberhalb des Grids) */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px 10px 0 0;
  border-bottom: none;
  flex-shrink: 0;
}
.cal-toolbar-label {
  margin-left: 10px;
  font-size: 15px; font-weight: 700;
  color: var(--text, #111827);
  letter-spacing: .01em;
  white-space: nowrap;
}
.cal-toolbar-year { color: var(--text-muted, #6b7280); font-weight: 600; margin-left: 4px; }
.cal-toolbar-range { color: var(--text-muted, #6b7280); font-weight: 600; font-size: 12.5px; margin-left: 8px; }

/* Umschalter Kalendermonat ↔ Lohnperiode (rechts in der Toolbar) */
.period-toggle {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  height: 26px; padding: 0 12px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  font: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--text, #374151);
  letter-spacing: .02em;
  cursor: pointer; user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  transition: background .12s ease, color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .08s ease;
}
.period-toggle:hover { background: #fff7ed; border-color: #fcd34d; }
.period-toggle:active { transform: translateY(1px); }
.period-toggle:focus-visible { outline: 2px solid #d97706; outline-offset: 2px; }
.period-toggle.is-active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
  box-shadow: 0 1px 3px rgba(245, 158, 11, .35);
}
.period-toggle.is-active:hover { background: #d97706; border-color: #d97706; }
.cal-toolbar .month-arrow {
  position: static;
  width: 28px; height: 28px;
  top: auto; left: auto; right: auto;
}
.cal-toolbar .today-btn { margin-right: 2px; }

/* Calendar-Container schliesst direkt unter der Toolbar an */
#calendar-wrapper > #calendar-container { border-top-left-radius: 0; border-top-right-radius: 0; }

.today-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 10px;
  margin: 0;
  vertical-align: middle;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font: inherit; font-size: 10.5px; font-weight: 700;
  color: var(--primary, #2563eb);
  letter-spacing: .04em;
  cursor: pointer; user-select: none;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .08);
  transition: background .12s ease, color .12s ease, box-shadow .12s ease, transform .08s ease;
}
.today-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  box-shadow: 0 2px 4px rgba(37, 99, 235, .15);
}
.today-btn:active { transform: translateY(1px); box-shadow: 0 1px 1px rgba(37, 99, 235, .12); }
.today-btn:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: 2px; }
.today-btn.is-current {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, .35);
}
.today-btn.is-current:hover {
  background: var(--primary-dark, #1d4ed8);
  border-color: var(--primary-dark, #1d4ed8);
}

/* Header-Row Hintergrund auf Row-Ebene → schliesst etwaige Lücken zwischen Cells optisch */
.header-row--month { background: #f7f8fa; }
.header-row--labels { background: #eef2ff; }

/* Monats-Pfeile (in der Toolbar) */
.month-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0; padding: 0;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: var(--primary, #2563eb);
  cursor: pointer; user-select: none;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .08);
  transition: background .12s ease, color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .08s ease;
}
.month-arrow svg { display: block; width: 14px; height: 14px; }
.month-arrow:hover {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .3);
}
.month-arrow:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(37, 99, 235, .2); }
.month-arrow:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: 2px; }

/* ── Pensum-Block im MA-Editor ─────────────────────────────────────────────── */
.emp-pensum-block { border-top: 1px solid var(--border-light); padding-top: 12px; }
.emp-pensum-top {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px; font-size: 12px;
}
.emp-pensum-lbl  { color: var(--text-muted); font-weight: 600; }
.emp-pensum-unit { color: var(--text-muted); margin-right: 4px; }
.emp-pensum-sep  { flex: 0 0 12px; }
.emp-pensum-num {
  width: 62px; padding: 5px 7px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  color: inherit; font-family: inherit;
}
.emp-pensum-days { display: flex; gap: 6px; }
.emp-pensum-days label {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
}
.emp-pensum-day {
  width: 100%; padding: 6px 4px; text-align: center; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  color: inherit; font-family: inherit;
}
.emp-pensum-day:placeholder-shown { color: var(--text-muted); }
.emp-pensum-summary {
  margin-top: 10px; padding: 8px 10px; border-radius: 7px;
  background: var(--bg, #f7f8fa); font-size: 12px; line-height: 1.55;
}
.emp-pensum-hint { color: var(--text-muted); font-weight: 400; }

/* Teilzeit-Badge auf dem Tagesansicht-Chip (Soll-Stunden dieses Tages) */
.dv-chip-soll {
  flex-shrink: 0; margin-left: auto;
  padding: 1px 5px; border-radius: 8px;
  background: #e0e7ff; color: #3730a3;
  font-size: 10px; font-weight: 800; line-height: 1.5;
  white-space: nowrap;
}
.dv-chip--nacht .dv-chip-soll { background: #334155; color: #e2e8f0; }

/* Pensum-Block: 14-Tage-Rhythmus */
.emp-pensum-days { align-items: flex-end; }
.emp-pensum-wk {
  flex: 0 0 18px; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: var(--text-muted);
  border-right: 2px solid var(--border-light); margin-right: 2px;
}
.emp-pensum-days--b { margin-top: 4px; }
.emp-pensum-toggle {
  display: flex; align-items: center; gap: 7px;
  margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer;
}
.emp-pensum-toggle input { cursor: pointer; }
.emp-pensum-anchor { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }

/* Pensum-Bilanz (Soll/Ist) */
.cell-stat.stat-bal-ok   { color: #059669; }
.cell-stat.stat-bal-plus { color: #0284c7; }
.cell-stat.stat-bal-neg  { color: #dc2626; }
.cell-stat.s4 { line-height: 1.15; }
.cell-stat.s4 .bal-days { display: block; font-size: 11px; }
.cell-stat.s4 .bal-h    { display: block; font-size: 9px; font-weight: 700; }
#grid.density-medium  .cell-stat.s4 .bal-days { font-size: 10px; }
#grid.density-compact .cell-stat.s4 .bal-days { font-size: 9px; }
#grid.density-compact .cell-stat.s4 .bal-h    { font-size: 8px; }

/* ½-Schalter im Kürzel-Wähler */
.shift-halfrow {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 0; flex-wrap: wrap;
}
.shift-half-btn.is-active {
  background: #0284c7; border-color: #0284c7; color: #fff;
}
.shift-half-hint { font-size: 11px; color: var(--text-muted); }

/* Wochen-Soll-Modus: Woche bereits erfüllt — Hinweis, KEINE Sperre.
   Deutlich zurückhaltender als .freeday, damit die zwei nicht verwechselt werden. */
.cell-shift.weeksoll-done {
  background: repeating-linear-gradient(90deg, #eef2f7 0 1px, transparent 1px 5px) !important;
}
.cell-stat.stat-bal-warn { box-shadow: inset 0 -2px 0 #d97706; }

/* ── Verlauf im MA-Editor (17.09.2026) ───────────────────────────────────────
   Zeigt die Zeitachse aus `emp.segments` zum NACHSCHLAGEN. Lesend, nicht bedienend —
   geaendert wird oben im Formular. */
.emp-history { border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.emp-history-frame {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 7px 10px; background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.emp-history-frame b { color: var(--text); font-weight: 600; }
.emp-history table { width: 100%; border-collapse: collapse; font-size: 12px; }
.emp-history th {
  text-align: left; font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
  padding: 6px 9px; background: var(--bg); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.emp-history td { padding: 7px 9px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.emp-history tr:last-child td { border-bottom: 0; }
.emp-history .eh-span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.emp-history .eh-pct  { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.emp-history .eh-sub  { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.emp-history tr.is-current td { background: #eff6ff; }
.emp-history .eh-now {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 9px;
  background: #0284c7; color: #fff; font-size: 9px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px;
}
.emp-history .eh-date {
  font-family: inherit; font-size: 11.5px; font-variant-numeric: tabular-nums;
  padding: 2px 5px; border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--text); width: 126px;
}
.emp-history .eh-date:hover  { border-color: var(--border); background: var(--surface); }
.emp-history .eh-date:focus  { border-color: #0284c7; background: var(--surface); outline: none; }
.emp-history td.eh-act { text-align: right; white-space: nowrap; width: 1%; }
.emp-history .eh-btn {
  font-family: inherit; font-size: 12px; line-height: 1;
  padding: 4px 7px; margin-left: 3px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface); color: var(--text-muted); cursor: pointer;
}
.emp-history .eh-btn:hover:not(:disabled) { border-color: #0284c7; color: #0284c7; }
.emp-history .eh-btn-del:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.emp-history .eh-btn:disabled { opacity: .35; cursor: not-allowed; }
.emp-history .eh-btn:focus-visible { outline: 2px solid #0284c7; outline-offset: 1px; }
.emp-history tr.is-editing td { background: #fff7ed; box-shadow: inset 3px 0 0 #d97706; }

.emp-history-note { padding: 7px 10px; font-size: 11px; color: var(--text-muted); background: var(--bg); border-top: 1px solid var(--border); }

/* Pensum-Modus-Umschalter im MA-Editor */
.emp-pensum-modes { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.emp-pensum-mode {
  flex: 1 1 auto; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text-muted);
  font-size: 11px; font-weight: 700; font-family: inherit; cursor: pointer;
  white-space: nowrap;
}
.emp-pensum-mode:hover { border-color: #94a3b8; }
.emp-pensum-mode.is-active { background: #0284c7; border-color: #0284c7; color: #fff; }
.emp-pensum-weeklyrow { margin-bottom: 0; }

/* Leeres Feld bei einem Teilzeit-MA: gleiche Schraffur wie ein freier Tag.
   Beide sagen dasselbe — „an diesem Tag ist sie nicht da". */
.cell-shift.notplanned {
  background: repeating-linear-gradient(45deg, #dbe4ee 0 3px, #f2f6fa 3px 7px) !important;
  opacity: .8;
}

/* ── Einsätze nach Abteilung (Auswertung) ──────────────────────────────────── */
.dh-block { margin-top: 26px; border-top: 2px solid #e5e7eb; padding-top: 16px; }
.dh-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dh-head h4 { margin: 0; font-size: 15px; font-weight: 800; color: #0f172a; }
.dh-total { font-size: 12px; font-weight: 700; color: #0369a1; }
.dh-sub { font-size: 11px; color: #6b7280; margin: 4px 0 10px; line-height: 1.5; max-width: 780px; }
.dh-note { font-size: 11px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
           border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.dh-warn { font-size: 11px; color: #991b1b; background: #fef2f2; border: 1px solid #fecaca;
           border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.dh-dept { border: 1px solid #e5e7eb; border-radius: 7px; margin-bottom: 5px; background: #fff; }
.dh-dept[open] { border-color: #cbd5e1; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.dh-dept > summary { display: flex; align-items: center; gap: 10px; padding: 7px 10px;
                     cursor: pointer; list-style: none; font-size: 12px; }
.dh-dept > summary::-webkit-details-marker { display: none; }
.dh-dept > summary::before { content: '▸'; color: #94a3b8; font-size: 10px; width: 9px; flex: none; }
.dh-dept[open] > summary::before { content: '▾'; }
.dh-name { font-weight: 700; color: #0f172a; min-width: 108px; flex: none; }
.dh-bar-wrap { flex: 1 1 auto; min-width: 60px; height: 7px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.dh-bar { display: block; height: 100%; background: #0ea5e9; border-radius: 4px; }
.dh-h { font-weight: 800; color: #0f172a; min-width: 74px; text-align: right; flex: none; }
.dh-d { color: #6b7280; min-width: 74px; text-align: right; flex: none; font-size: 11px; }
.dh-sup { color: #b45309; background: #fef3c7; border-radius: 4px; padding: 1px 6px;
          font-size: 10px; font-weight: 700; flex: none; }
.dh-segs { display: flex; gap: 14px; flex-wrap: wrap; padding: 0 10px 8px 29px; font-size: 11px; color: #475569; }
.dh-segs b { color: #0f172a; }
.dh-emps { padding: 0 10px 8px 29px; }
.dh-emp { display: flex; gap: 10px; align-items: baseline; font-size: 11px;
          padding: 2px 0; border-top: 1px solid #f1f5f9; }
.dh-emp-name { min-width: 108px; color: #334155; }
.dh-emp-h { min-width: 62px; text-align: right; font-weight: 700; color: #0f172a; }
.dh-emp-d { min-width: 50px; text-align: right; color: #94a3b8; }
.dh-emp-s { color: #b45309; }

.dh-csv-btn { margin-left: auto; }

/* ── Kürzelspalten der Auswertung: Stunden in farbigen Chips ───────────────── */
/* Die zweite Zahl (Aushilfe) steckt immer im HTML und wird nur ein- und
   ausgeblendet. So bleibt das Umschalten sofortig und rechnet nichts neu. */
.stats-table td.k-cell, .stats-table th.k-cell { text-align: center; padding: 3px 5px; }
.k-chip { display: inline-block; min-width: 38px; padding: 2px 6px; border-radius: 5px;
          font-weight: 800; font-size: 11px; line-height: 1.35; text-align: center;
          font-variant-numeric: tabular-nums; }
.k-chip.k-head { min-width: 0; font-size: 10px; letter-spacing: .02em; }
.k-chip.k-aus  { box-shadow: 0 0 0 2px #d97706 inset; }
.k-tot { display: block; font-size: 9px; font-weight: 700; color: #6b7280; margin-top: 2px; }
.k-empty { color: #d1d5db; }
.k-sum { font-weight: 800; font-variant-numeric: tabular-nums; }
.stats-table tr.stats-sum td { background: #f8fafc; font-weight: 800;
                               border-top: 2px solid #e2e8f0; }
.lehr-badge { display: inline-block; width: 13px; height: 13px; line-height: 13px;
              text-align: center; border-radius: 3px; background: #d97706; color: #fff;
              font-size: 9px; font-weight: 800; margin-right: 5px; vertical-align: 1px; }
.stats-table tr.row-lehre td { background: #fdfaff; }

/* Stundenlohn: „Std" neben dem Namen. Teal, bewusst weder das Amber des „L" noch
   das Blau von KO. Gleiche Hoehe wie .lehr-badge, damit beide nebeneinander passen. */
.std-badge  { display: inline-block; height: 13px; line-height: 13px; padding: 0 4px;
              text-align: center; border-radius: 3px; background: #0f766e; color: #fff;
              font-size: 9px; font-weight: 800; margin-right: 5px; vertical-align: 1px;
              letter-spacing: .2px; }
.cell-name .std-badge { vertical-align: 1px; }
.eh-std     { color: #0f766e; font-weight: 700; }
.emp-pensum-top.is-disabled { opacity: .45; }
.emp-pensum-hourly input[type=checkbox] { vertical-align: -2px; margin: 0 4px 0 0; }
.shift-btn--blocked { opacity: .3; filter: grayscale(.7); cursor: not-allowed; }

/* Zweifarbiger Balken: regulär gegen Lehre. Das Farbpaar #0284c7/#d97706 besteht
   alle sechs Prüfungen inklusive Farbsehschwäche. 2px Lücke zwischen den
   Segmenten, damit die Grenze auch ohne Farbunterscheidung sichtbar ist. */
.dh-bar-wrap { display: flex; }
.dh-bar-lehr { background: #d97706; box-shadow: -2px 0 0 #fff; }
.dh-lehr { color: #7c3aed; background: #f5f3ff; border-radius: 4px; padding: 1px 6px;
           font-size: 10px; font-weight: 700; flex: none; }
.dh-legend { display: inline-flex; align-items: center; gap: 5px; font-size: 10px;
             color: #6b7280; margin-left: 4px; }
.dh-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.dh-key-n { background: #0284c7; }
.dh-key-l { background: #d97706; margin-left: 8px; }
.dh-emp.is-lehr .dh-emp-name { color: #b45309; font-weight: 600; }

/* ── Zusatzfeld "Aushilfe" + Aufklappzeile ─────────────────────────────────── */
.stats-table td.sup-cell { text-align: center; font-variant-numeric: tabular-nums; }
.sup-btn { font: inherit; font-size: 11px; font-weight: 800; color: #b45309;
           background: #fffbeb; border: 1px solid #fde68a; border-radius: 5px;
           padding: 2px 8px; cursor: pointer; line-height: 1.3; white-space: nowrap; }
.sup-btn::after { content: ' \25be'; font-size: 9px; opacity: .7; }
.sup-btn:hover { background: #fef3c7; }
.sup-btn.is-open { background: #d97706; border-color: #d97706; color: #fff; }
.sup-btn.is-open::after { content: ' \25b4'; }
.stats-table tr.sup-row.is-hidden { display: none; }
.stats-table tr.sup-row td { background: #fffbeb; border-bottom: 1px solid #fde68a;
                             padding: 6px 10px; white-space: normal; }
.sup-lbl { font-size: 10px; font-weight: 700; color: #92400e; text-transform: uppercase;
           letter-spacing: .04em; margin-right: 12px; }
.sup-part { display: inline-flex; align-items: center; gap: 5px; margin: 2px 14px 2px 0; }
.sup-part b { font-size: 11.5px; color: #0f172a; font-variant-numeric: tabular-nums; }

/* Gruppenwechsel mitten im Jahr: eigenes Zeichen, damit die Zeile nicht behauptet,
   jemand sei das ganze Jahr Lehrling gewesen. */
.lehr-badge--teil { width: auto; padding: 0 4px; background: #fff; color: #b45309;
                    box-shadow: inset 0 0 0 1.5px #d97706; }
.lehr-badge--teil em { font-style: normal; font-size: 8px; font-weight: 700;
                       margin-left: 3px; opacity: .85; }
.stats-table tr.row-lehre-teil td { background: #fffdf7; }

/* Abteilung je Abschnitt im Verlauf */
.emp-history td.eh-dept { white-space: nowrap; }
.eh-depin { width: 120px; font: inherit; font-size: 11px; padding: 2px 5px;
            border: 1px solid #e2e8f0; border-radius: 5px; background: #fff; }
.eh-depin:focus { border-color: #0284c7; outline: none; }
.eh-lehr { display: inline-block; margin-left: 5px; font-size: 9px; font-weight: 800;
           color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
           border-radius: 4px; padding: 1px 5px; vertical-align: 1px; }

/* Vorschlaege aus den Tagesdaten (MA-Editor, 20.10.2026) */
.eh-sugg { margin: 8px 10px; padding: 8px 10px; border: 1px solid #bae6fd; background: #f0f9ff; border-radius: 8px; font-size: 12px; }
.eh-sugg-title { font-weight: 800; color: #0369a1; margin-bottom: 4px; }
.eh-sugg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; }
.eh-sugg-btn { white-space: nowrap; }
.eh-sugg-note { margin-top: 4px; font-size: 11px; color: var(--text-muted); }
.dd-conflict-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 10050; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dd-conflict-box { background: #fff; border-radius: 12px; max-width: 520px; width: 100%; padding: 18px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); font-size: 13px; }
.dd-conflict-title { font-weight: 800; font-size: 15px; color: #b45309; margin-bottom: 6px; }
.dd-conflict-sub { color: var(--text-muted); margin: 6px 0; }
.dd-conflict-box ul { margin: 6px 0 6px 18px; padding: 0; }
.dd-conflict-box li { margin: 3px 0; }
.dd-conflict-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Stundenfenster: Abteilung im selben Fenster (20.10.2026) */
.dv-hours-dept-row { display: flex; align-items: center; gap: 8px; padding: 0 14px 8px; }
.dv-hours-dept-row label { font-size: 12px; font-weight: 700; color: #334155; min-width: 70px; }
.dv-hours-dept { flex: 1; font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; }
.dv-hours-dept:focus { border-color: #0284c7; outline: none; }

/* ── Kürzel-Fenster (neu 20.10.2026): Kopf · Empfohlen · nach Abteilung · Stunden ── */
.shift-box { min-width: 0; width: min(620px, 94vw); }
.shift-sub { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 18px 2px; font-size: 12px; color: var(--text-muted); }
.shift-sub b { color: var(--text); }
.shift-sec-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 12px 18px 6px; }
.shift-reco { border-bottom: 1px solid var(--border-light); padding-bottom: 12px; }
.shift-reco-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 18px; }
.shift-btn--reco { padding: 10px 6px 8px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.shift-btn--reco .shift-code { font-size: 18px; }
.shift-btn--reco .shift-label { font-size: 10px; }
.shift-btn .shift-why { display: block; margin-top: 4px; font-size: 9px; font-weight: 600; opacity: .9; background: rgba(255,255,255,.28); border-radius: 999px; padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-groups { padding: 0 0 4px; max-height: 42vh; overflow-y: auto; }
.sg-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; padding: 3px 18px; }
.sg-label { font-size: 11px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.sg-codes { display: flex; flex-wrap: wrap; gap: 5px; }
.sg-codes .shift-btn { min-width: 64px; padding: 5px 8px; }
.sg-codes .shift-btn .shift-code { font-size: 12px; }
.sg-codes .shift-btn .shift-label { font-size: 9px; }
.shift-hours { border-top: 1px solid var(--border-light); padding-bottom: 8px; }
.shift-hours.is-disabled { opacity: .45; pointer-events: none; }
.sh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 18px; }
.sh-opt { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; color: var(--text); cursor: pointer; }
.sh-opt.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sh-input { width: 76px; font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; margin-left: 6px; }
.sh-input.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.2); }
.sh-unit { font-size: 12px; color: var(--text-muted); }
.sh-note { font-size: 11px; color: var(--text-muted); padding: 6px 18px 0; }
.shift-box .repeat-section { border-top: 1px solid var(--border-light); }
.shift-actions { padding: 12px 18px 14px; border-top: 1px solid var(--border-light); }
@media (max-width: 520px) {
  .shift-reco-row { grid-template-columns: repeat(2, 1fr); }
  .sg-row { grid-template-columns: 1fr; gap: 4px; }
}
/* zwei Spalten fuer die Abteilungen, Beschriftung ueber den Kuerzeln */
.shift-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; padding: 0 18px 6px; max-height: 46vh; }
.shift-groups .shift-sec-label { grid-column: 1 / -1; padding-left: 0; padding-right: 0; }
.shift-groups .sg-row { display: block; padding: 3px 0 5px; }
.shift-groups .sg-label { margin-bottom: 4px; font-size: 11px; }
@media (max-width: 520px) { .shift-groups { grid-template-columns: 1fr; } }
