:root {
  color-scheme: light dark;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #edf3f2;
  --ink: #18211f;
  --muted: #687370;
  --line: #dde5e3;
  --line-strong: #b9c6c1;
  --accent: #1f7564;
  --accent-ink: #ffffff;
  --accent-soft: #e4f3ef;
  --accent-strong: #1f2b28;
  --primary: #1f7564;
  --primary-soft: #e4f3ef;
  --warning: #bd7a13;
  --danger: #b53b32;
  --danger-soft: #f6e7e5;
  --weekend: rgba(31, 43, 40, 0.07);
  --holiday: rgba(189, 122, 19, 0.2);
  --shadow: 0 18px 44px rgba(20, 31, 28, 0.12);
  --card-shadow: 0 6px 18px rgba(20, 31, 28, 0.04);
  --name-col: 168px;
  --pm-col: 30px;
  --role-col: 30px;
  --day-col: 36px;
  --summary-col: 28px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513;
    --surface: #171d1b;
    --surface-muted: #202a27;
    --ink: #edf3f1;
    --muted: #9aa8a4;
    --line: #2a3632;
    --line-strong: #3a4843;
    --accent: #43b69d;
    --accent-ink: #08130f;
    --accent-soft: #173a33;
    --accent-strong: #0c1715;
    --primary: #43b69d;
    --primary-soft: #173a33;
    --warning: #e1aa4c;
    --danger: #e06f63;
    --danger-soft: #3a1c19;
    --weekend: rgba(255, 255, 255, 0.08);
    --holiday: rgba(225, 170, 76, 0.2);
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
    --card-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 360px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    filter 0.15s ease,
    color 0.15s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

button {
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 6px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.brand h1 {
  font-size: 21px;
  line-height: 1.1;
}

.eyebrow {
  order: 2;
  margin: 3px 0 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  margin-bottom: 14px;
}

.toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toolbar button svg {
  flex: none;
}

.switch-field {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.year-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.year-switch .year-step {
  display: flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.year-switch .year-step:hover {
  background: var(--accent);
  color: #fff;
}

.year-switch .year-current {
  min-width: 50px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.month-switch .year-current {
  min-width: 86px;
}

.toolbar button,
.panel button:not(.emp-card):not(.emp-arrow):not(.ghost-btn):not(.emp-add-btn):not(.emp-row-x):not(.emp-toggle):not(.emp-avail-copy):not(.shift-icon-btn):not(.dp-trigger):not(.year-step):not(.subtle-button):not(.rc-multi) {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.toolbar button:hover,
.panel button:not(.emp-card):not(.emp-arrow):not(.ghost-btn):not(.emp-add-btn):not(.emp-row-x):not(.emp-toggle):not(.emp-avail-copy):not(.shift-icon-btn):not(.dp-trigger):not(.rc-multi):hover {
  filter: brightness(0.9);
}

body:not(.planner-active) .toolbar {
  display: none;
}

#autoPlanButton {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#clearMonthButton {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

#resetButton {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

#resetButton:hover {
  filter: none;
  background: var(--surface-muted);
}

.tabs {
  display: flex;
  align-items: center;
  align-self: center;
  justify-self: center;
  gap: 4px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.tab-button {
  position: relative;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  font-weight: 700;
}

.tab-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.tab-button.active {
  background: var(--accent-strong);
  border-color: transparent;
  color: #fff;
}

main {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 14px 18px 28px;
}

main:has(#plannerView.active) {
  width: min(100%, 1420px);
}

main:has(#settingsView.active) {
  width: min(100%, 1480px);
}

body.planner-active main {
  width: min(100%, 1420px);
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 820px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.metric {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px 14px;
  box-shadow: var(--card-shadow);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease;
}

.metric-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(20, 31, 28, 0.1);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.metric-icon svg {
  width: 24px;
  height: 24px;
}

.metric-icon.mi-blue {
  background: #e3edff;
  color: #2563eb;
}

.metric-icon.mi-cyan {
  background: #d6f1ee;
  color: #0e9488;
}

.metric-icon.mi-amber {
  background: #fcecd2;
  color: #d8902a;
}

.metric-icon.mi-green {
  background: #ddf2df;
  color: #2e9e4f;
}

.metric-icon.mi-purple {
  background: #ece2fb;
  color: #7c5cd6;
}

.metric-body > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.metric.negative strong {
  color: var(--danger);
}

.metric .metric-unit {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
  font-style: normal;
  color: var(--muted);
}

.metric .metric-sub {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.planner-shell,
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.panel:hover {
  box-shadow: 0 12px 30px rgba(20, 31, 28, 0.08);
}

.planner-head,
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px 12px 0 0;
}

.employee-panel > .panel-head {
  align-items: center;
}

#monthMeta,
.panel-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 8px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.sync-status.ok {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.sync-status.error {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.sync-status.warning {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--line));
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  color: var(--warning);
}

.subtle-button {
  margin-top: 12px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

#dataStatus {
  padding-top: 8px;
  line-height: 1.35;
}

.subtle-button:hover {
  background: var(--surface-muted);
}

.employee-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  align-self: center;
}

.employee-head-actions .subtle-button,
.employee-head-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  min-height: 36px;
  height: 36px;
  min-width: 168px;
  padding: 0 16px;
  line-height: 1;
}

.plan-add-control {
  display: inline-flex;
  margin-top: 10px;
}

.plan-add-control select {
  min-width: 230px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.plan-add-control select:disabled {
  color: var(--muted);
  opacity: 0.75;
}

.shift-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.planner-message {
  flex: 1 1 260px;
  min-width: 180px;
  min-height: 18px;
  margin: 0 2px 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 28px;
  border: 1px solid #dce8e6;
  border-radius: 999px;
  background: #f5fbfa;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.table-wrap {
  overflow: hidden;
  border-radius: 0 0 12px 12px;
}

.planner-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.planner-table th,
.planner-table td,
.balance-table th,
.balance-table td {
  box-sizing: border-box;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.planner-table th:first-child,
.planner-table td:first-child,
.balance-table th:first-child,
.balance-table td:first-child {
  border-left: 0;
}

.planner-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 48px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.planner-table .day-head {
  font-size: 12px;
  line-height: 1.2;
  color: var(--ink);
  font-weight: 500;
  padding: 4px 0;
}

.planner-table .day-head .dh-day {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.planner-table .day-head .dh-wd {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.9;
}

/* Kommentarzeile über der Datumsleiste */
.planner-table {
  --comment-h: 116px;
  --gap-col: 8px;
}

.planner-table .gap-col {
  width: var(--gap-col);
}

.planner-table .gap-cell {
  border: 0;
  background: var(--surface);
  padding: 0;
}

.planner-table .comment-row .comment-gap {
  background: transparent;
}

.planner-table .comment-row th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: var(--comment-h);
  background: #f8fafc;
  border-top: 0;
  padding: 0;
  vertical-align: bottom;
}

.planner-table .comment-row .comment-corner {
  background: #fbfcfd;
}

.planner-table .comment-cell {
  position: relative;
  overflow: hidden;
  background: #fff;
}

.comment-input {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--comment-h);
  height: 12px;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--muted);
  text-align: left;
  white-space: normal;
  word-break: break-word;
  font: 600 9px/1.25 Inter, "Segoe UI", system-ui, sans-serif;
  padding: 0 6px;
}

.comment-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* Datumszeile dockt unter der Kommentarzeile an */
.planner-table .date-row th {
  top: var(--comment-h);
}

/* Steuerelemente in der linken oberen Ecke der Tabelle */
.planner-table #plannerCorner {
  vertical-align: middle;
  padding: 0;
  background: #fff;
  border-right: 0;
}

/* Linie in der Kommentarzeile an der linken Kante von Tag 1 (Verlängerung) */
.planner-table .comment-row .comment-cell.month-start {
  border-left: 1px solid var(--line) !important;
}

.planner-table .comment-row .comment-cell.month-end {
  border-right: 1px solid var(--line) !important;
}

.planner-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 8px 10px;
  box-sizing: border-box;
  width: 100%;
  white-space: normal;
}

.planner-controls .planner-period {
  margin: 0;
}

.planner-controls .planner-period .year-current {
  font-size: 14px;
  font-weight: 700;
  min-width: 96px;
}

.planner-controls #monthMeta {
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.planner-controls .plan-add-control {
  position: relative;
  margin: 0;
  width: 100%;
}

.planner-controls .plan-add-control select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 30px 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: transparent;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.planner-controls .plan-add-control select:hover {
  border-color: var(--line);
  background-color: var(--surface);
  color: var(--ink);
}

.plan-add-plus {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.planner-controls .plan-add-control select:disabled + .plan-add-plus {
  opacity: 0.4;
}

.planner-controls .plan-add-control select:disabled {
  cursor: default;
}

@media (prefers-color-scheme: dark) {
  .planner-table th {
    background: #1b2320;
  }
  .planner-table:not(.occupancy-table) tbody tr:hover td:not(.employee):not(.pm-cell):not(.role-cell) {
    background-color: #1f2a26;
  }
}

.planner-table .day-head.weekend {
  color: var(--accent);
}

.planner-table .day-head.holiday {
  color: var(--warning);
}

.planner-table:not(.occupancy-table) tbody tr:hover td:not(.employee):not(.pm-cell):not(.role-cell):not(.gap-cell) {
  background-color: #f1f5f9;
}

.planner-table .name-head,
.planner-table .employee {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: var(--name-col);
  max-width: var(--name-col);
  background: #fff;
  text-align: left;
}

.planner-table .pm-head,
.planner-table .pm-cell {
  position: sticky;
  left: calc(var(--name-col) + var(--role-col));
  z-index: 4;
  min-width: var(--pm-col);
  max-width: var(--pm-col);
  background: #fff;
}

/* +/- Werte schmal, nicht fett, kleiner (überschreibt .summary) */
.planner-table .summary.pm-cell {
  font-weight: 400;
  font-size: 9px;
}

.planner-table .pm-cell.pos {
  color: #16a34a;
}

.planner-table .pm-cell.neg {
  color: #dc2626;
}

.planner-table .role-head,
.planner-table .role-cell {
  position: sticky;
  left: var(--name-col);
  z-index: 4;
  min-width: var(--role-col);
  max-width: var(--role-col);
  background: #fff;
}

.planner-table .name-head,
.planner-table .pm-head,
.planner-table .role-head {
  z-index: 5;
  background: #fbfcfd;
}

.planner-table .name-head {
  padding-left: 57px;
}

.planner-table .employee {
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.employee-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.employee-cell .emp-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emp-remove {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-left: auto;
  border: none;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
}

.planner-table tbody td.employee:hover .emp-remove {
  opacity: 1;
  visibility: visible;
}

.emp-remove:hover {
  background: #fecaca;
}

.emp-cell-avatar-wrap {
  position: relative;
  flex: 0 0 24px;
  display: inline-grid;
  place-items: center;
}

.emp-cell-avatar {
  flex: 0 0 24px;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 24px;
  min-width: 24px;
  max-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  line-height: 1;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.emp-cell-alert {
  position: absolute;
  top: -5px;
  right: -6px;
  width: 15px;
  height: 14px;
  display: grid;
  place-items: end center;
  padding-bottom: 1px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #f6c343;
  color: #4b3200;
  font-size: 7px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.plan-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.plan-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.row-delete {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid #fecaca;
  border-radius: 5px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.row-delete:hover {
  background: #ffe4e6;
}

.planner-table .role-cell {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.planner-table .day-head,
.planner-table .day-cell {
  min-width: var(--day-col);
  max-width: var(--day-col);
  text-align: center;
  vertical-align: middle;
}

.planner-table .day-head.month-start,
.planner-table .day-cell.month-start {
  border-left: 2px solid var(--line-strong);
}

.planner-table .day-head.month-end,
.planner-table .day-cell.month-end {
  border-right: 2px solid var(--line-strong);
}

/* Belegungstabelle: Kalenderkante an erster/letzter Tagesspalte wie im Planer */
.occupancy-table .occ-cell.month-start {
  border-left: 2px solid var(--line-strong);
}

.occupancy-table .occ-cell.month-end {
  border-right: 2px solid var(--line-strong);
}

/* Linke Trennlinie an der ersten Summen-Spalte (Frei +/-) – nicht in der Kommentarzeile */
.planner-table .gap-cell + .summary-head:not(.comment-corner),
.planner-table .gap-cell + .summary,
.planner-table .gap-cell + .occupancy-total {
  border-left: 1px solid var(--line);
}

.planner-table .day-head {
  border-top: 2px solid var(--line-strong);
}

.planner-table tbody tr:nth-last-child(2) .day-cell {
  border-bottom: 2px solid var(--line-strong);
}

.planner-table .summary-head,
.planner-table .summary {
  min-width: var(--summary-col);
  max-width: var(--summary-col);
  background: #fbfcfd;
  color: #343b45;
  padding-left: 2px;
  padding-right: 2px;
}

.planner-table .summary-head {
  font-size: 9px;
}

.planner-table .summary {
  font-size: 11px;
  font-weight: 700;
}

.planner-table input {
  width: 100%;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  line-height: 40px;
  padding: 0;
  font-size: 15px;
  font-weight: 850;
  text-transform: uppercase;
}

.planner-table input.long-code {
  font-size: 11px;
  letter-spacing: -0.4px;
  padding: 0 1px;
}

.planner-table input:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 8px;
}

.planner-table input:focus {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}

.weekend {
  background: var(--weekend) !important;
}

.holiday {
  background: var(--holiday) !important;
}

.inactive-day {
  opacity: 0.55;
}

.inactive-day input {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--muted);
}

.planner-table tfoot th,
.planner-table tfoot td {
  height: 32px;
  background: #fbfcfd;
  font-size: 10px;
  font-weight: 850;
  border-top: 1px solid var(--line) !important;
  text-align: center;
  vertical-align: middle;
}

.planner-table tfoot tr:first-child th,
.planner-table tfoot tr:first-child td {
  border-top: 1px solid var(--line) !important;
}

.planner-table .occupancy-label {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  padding-left: 8px;
  color: var(--muted);
  text-align: left;
  border-right: 0;
}

.planner-table .occupancy-total {
  background: #f7f8fa;
  color: var(--muted);
  font-weight: 500;
}

.planner-table .ok {
  color: var(--accent);
}

.planner-table .missing {
  background: #fee2e2 !important;
  color: #b42318;
  box-shadow: inset 0 0 0 1px rgba(224, 111, 99, 0.42);
}

.occupancy-panel {
  margin-top: 14px;
}

.occupancy-table th,
.occupancy-table td {
  position: static;
  top: auto;
  height: 34px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 850;
  vertical-align: middle;
}

.occupancy-table .occupancy-label {
  text-align: left;
  padding-left: 10px;
  color: var(--muted);
  font-weight: 500;
}

.occupancy-table .occupancy-total {
  background: var(--surface-muted);
  color: var(--muted);
}

/* Fehlende Besetzung als rote Bubble statt roter Zelle */
.occupancy-table td.missing {
  background: var(--surface) !important;
  box-shadow: none !important;
  color: inherit;
}

.occupancy-table .occ-val {
  font-weight: 500;
}

.occupancy-table td.missing .occ-val {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #fca5a5;
  color: #7f1d1d;
  font-weight: 700;
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(300px, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(340px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.settings-stack {
  display: grid;
  gap: 14px;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1000px) {
  .settings-row {
    grid-template-columns: 1fr;
  }
}

/* Custom-Dropdown (ersetzt natives Select-Menü) */
.cs-menu {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
}

.cs-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cs-avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.cs-opt:hover {
  background: var(--surface-muted);
}

.cs-opt.sel {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.cs-opt[disabled] {
  opacity: 0.5;
  cursor: default;
}

select.cs-open {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ===== Schicht-Editor (Master-Detail) ===== */
.shift-settings-panel .panel-head {
  align-items: center;
}

.shift-editor {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
}

.shift-master {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shift-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shift-li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.shift-li.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.shift-li-color {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.shift-li-main {
  display: grid;
  min-width: 0;
}

.shift-li-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.shift-li-main small {
  color: var(--muted);
  font-size: 12px;
}

.shift-li-active {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.shift-li-handle {
  color: var(--muted);
  cursor: grab;
  font-size: 16px;
  letter-spacing: -2px;
}

.shift-li {
  will-change: transform;
}

.shift-li.dragging {
  opacity: 0.4;
}

.shift-li-placeholder {
  min-height: 58px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  animation: shiftPhIn 0.18s ease;
}

@keyframes shiftPhIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.shift-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.shift-info {
  display: inline-flex;
  color: var(--accent);
  flex: none;
}

.shift-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
}

.shift-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shift-detail-head .ghost-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c0392b;
}

.shift-detail-head .ghost-danger svg {
  width: 15px;
  height: 15px;
}

.shift-detail-color {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.shift-detail-title {
  flex: 1;
  min-width: 0;
}

.shift-detail-title h3 {
  font-size: 18px;
  font-weight: 600;
}

.shift-detail-title small {
  color: var(--muted);
  font-size: 13px;
}

.shift-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.shift-fields label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.shift-fields input,
.shift-fields select,
.shift-fields .shift-calc {
  height: 32px;
  min-height: 32px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
  font-weight: 400;
  font-size: 14px;
}

.shift-fields select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.shift-std {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shift-std input {
  flex: 1;
  min-width: 56px;
  text-align: center;
}

.shift-calc {
  display: flex;
  align-items: center;
  min-height: 34px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.shift-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.shift-day-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}

.shift-day {
  display: grid;
  gap: 4px;
  justify-items: center;
  align-content: start;
  padding: 8px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9fb;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .shift-day {
    background: #1f2522;
  }
}

.shift-day.dev {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--line));
}

.shift-day-name {
  justify-self: stretch;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 -4px 6px;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--line);
}

.shift-day-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.shift-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.shift-dot.green {
  background: #6cc04a;
}

.shift-dot.amber {
  background: var(--warning);
}

.shift-day-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 28px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.shift-clock-ico {
  display: inline-flex;
  color: var(--muted);
}

.shift-day-dash {
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}

.shift-day-lock {
  min-height: 16px;
  line-height: 1;
  margin-top: 2px;
  color: var(--warning);
}

/* clock-input (Standardzeit + Abweichung-Edit) */
.shift-clock-input {
  position: relative;
  display: inline-flex;
  flex: 1;
  min-width: 56px;
}

.shift-clock-input input {
  width: 100%;
  min-width: 0;
  padding-right: 26px !important;
  text-align: left;
}

.shift-clock-input .shift-clock-ico {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.shift-dash {
  color: var(--muted);
}

/* Vorschau */
.shift-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.shift-preview-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f9fb;
}

@media (prefers-color-scheme: dark) {
  .shift-preview-card {
    background: #1f2522;
  }
}

.shift-preview-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: #eceef1;
  color: #6b7280;
}

@media (prefers-color-scheme: dark) {
  .shift-preview-icon {
    background: #2a322e;
    color: #aeb4b1;
  }
}

.shift-preview-icon svg {
  width: 18px;
  height: 18px;
}

.shift-preview-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.shift-preview-card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Tabellen-Zellen */
.shift-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--ink);
}

.shift-actions {
  white-space: nowrap;
  text-align: center;
}

.shift-actions-col {
  text-align: center;
}

.shift-range-edit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shift-icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  margin-left: 6px;
}

.shift-icon-btn:hover {
  color: var(--ink);
}

.shift-icon-btn.primary {
  color: var(--accent);
  font-weight: 800;
}

.shift-dev-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.shift-dev-table th:nth-child(1),
.shift-dev-table td:nth-child(1) {
  width: 18%;
}

.shift-dev-table th:nth-child(2),
.shift-dev-table td:nth-child(2) {
  width: 34%;
}

.shift-dev-table th:nth-child(3),
.shift-dev-table td:nth-child(3) {
  width: 12%;
}

.shift-dev-table th:nth-child(4),
.shift-dev-table td:nth-child(4) {
  width: 26%;
}

.shift-dev-table th:nth-child(5),
.shift-dev-table td:nth-child(5) {
  width: 10%;
}

.shift-dev-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.shift-dev-table td {
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.shift-dev-table td.empty {
  color: var(--muted);
  text-align: center;
}

.shift-dev-table input,
.shift-dev-table select {
  width: 100%;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 6px;
}

/* Werte (Eingaben) exakt unter die Anzeige-Werte rücken: Rand(1)+Innenabstand(6) ausgleichen */
.shift-dev-table td:nth-child(2) .shift-range-edit {
  margin-left: -7px;
}

.shift-dev-table td:nth-child(3) select {
  margin-left: -7px;
}

@media (max-width: 900px) {
  .shift-editor {
    grid-template-columns: 1fr;
  }
  .shift-day-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.vacation-list {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.vacation-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.05fr) minmax(128px, 0.7fr) minmax(230px, 1.3fr) 46px 28px;
  gap: 7px;
  align-items: center;
}

.vacation-row select,
.vacation-row input,
.inline-field select,
.employee-table input,
.employee-table select,
.availability-table input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
}

.vacation-days {
  text-align: center;
}

.vacation-remove {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 900;
}

.vacation-remove:hover {
  background: #eef1f5;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.compact {
  max-height: 360px;
}

.balance-table,
.employee-table,
.availability-table,
.staffing-rules {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.balance-table th,
.balance-table td {
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

.balance-table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 850;
}

.balance-table td:first-child,
.balance-table th:first-child {
  text-align: left;
}

.employee-panel,
.availability-panel,
.settings-panel {
  max-width: 100%;
}

.employee-profile-layout {
  display: grid;
  gap: 14px;
}

.employee-card-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 142px;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.employee-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 142px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  color: var(--ink);
  text-align: left;
  transition:
    border-color 0.14s ease,
    background 0.14s ease,
    transform 0.14s ease,
    box-shadow 0.14s ease;
}

.employee-card-toggle {
  position: absolute;
  top: 9px;
  right: 9px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 18px;
}

.employee-card-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.employee-card-toggle span {
  display: block;
  width: 28px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 34%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 28%, transparent);
}

.employee-card-toggle span::after {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 2px;
  border-radius: 999px;
  background: var(--surface);
  transition: transform 140ms ease;
}

.employee-card-toggle input:checked + span {
  background: var(--accent);
}

.employee-card-toggle input:checked + span::after {
  transform: translateX(10px);
}

.employee-panel .employee-card {
  color: var(--ink);
}

.employee-panel .employee-card-main strong {
  color: var(--ink);
}

.employee-panel .employee-card-main small,
.employee-panel .employee-card-meta {
  color: var(--muted);
}

.employee-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--surface));
  box-shadow: 0 12px 24px rgba(20, 31, 28, 0.11);
  transform: translateY(-2px);
}

.employee-card.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow:
    inset 0 3px 0 var(--accent),
    0 10px 22px rgba(20, 31, 28, 0.08);
}

.employee-card.active .employee-card-main strong,
.employee-card.active .employee-card-main small,
.employee-card.active .employee-card-meta,
.employee-card.active .employee-card-meta b,
.employee-card.active .employee-card-meta small {
  color: var(--accent-ink);
}

.employee-card.active .employee-avatar {
  background: color-mix(in srgb, var(--accent-ink) 88%, transparent);
  color: var(--accent);
}

.employee-card.active .employee-card-toggle span {
  background: color-mix(in srgb, var(--accent-ink) 42%, transparent);
}

.employee-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 900;
}

.employee-card-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.employee-card-main strong,
.employee-card-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-card-main strong {
  font-size: 13px;
}

.employee-card-main small,
.employee-card-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.employee-card-meta {
  display: grid;
  gap: 2px;
  align-self: end;
  justify-self: stretch;
}

.employee-card-meta b {
  color: var(--ink);
  font-size: 12px;
}

.employee-card-meta small {
  color: var(--muted);
  font-size: 11px;
}

.employee-profile {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.profile-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  font-size: 19px;
}

.profile-head h3 {
  margin: 2px 0 3px;
  font-size: 20px;
  line-height: 1.15;
}

.profile-head p,
.profile-kicker,
.profile-grid label,
.profile-stats span,
.absence-item small {
  color: var(--muted);
}

.profile-kicker {
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-main {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(128px, 1fr));
  gap: 10px;
}

.profile-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: 11px;
  font-weight: 850;
}

.profile-grid input,
.profile-grid select,
.profile-grid .dp-trigger {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
}

.profile-grid input:hover,
.profile-grid select:hover,
.profile-grid .dp-trigger:hover {
  border-color: var(--line-strong);
}

.profile-grid input:focus,
.profile-grid select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.profile-grid .dp-trigger {
  display: flex;
  align-items: center;
  width: 100%;
}

.profile-check {
  align-content: start;
}

.profile-check input[type="checkbox"] {
  appearance: none;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: pointer;
}

.profile-check input[type="checkbox"]:checked {
  border-color: var(--accent);
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2 7.4 12.4 14 5.7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 18px 18px no-repeat,
    var(--accent);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profile-stats div {
  display: grid;
  gap: 3px;
  min-height: 58px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.profile-stats strong {
  font-size: 18px;
}

.vacation-progress-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.vacation-progress-head,
.vacation-progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vacation-progress-head span,
.vacation-progress-foot {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.vacation-progress-head strong {
  color: var(--ink);
  font-size: 13px;
}

.vacation-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 72%, var(--surface));
}

.vacation-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 66%, #ffffff));
  transition: width 0.7s ease;
}

.profile-section {
  display: grid;
  gap: 9px;
  min-width: 0;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.profile-section h4 {
  margin: 0;
  font-size: 13px;
}

.profile-availability,
.profile-absence-list {
  display: grid;
  gap: 7px;
}

.profile-availability {
  grid-template-columns: repeat(8, minmax(96px, 1fr));
  align-items: stretch;
}

.availability-chip,
.absence-item {
  display: grid;
  grid-template-columns: minmax(72px, 0.65fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  font-size: 12px;
}

.availability-chip {
  grid-template-columns: 1fr;
  gap: 4px;
  min-height: 64px;
  align-content: center;
  text-align: center;
  background: var(--surface);
}

.availability-chip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.availability-chip strong {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.15;
}

.availability-chip.off strong {
  color: var(--danger);
}

.absence-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ====== Mitarbeiter-Seite (neu) ====== */
.employee-profile-root {
  padding: 8px 16px 18px;
}

.emp-carousel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.emp-arrow {
  flex: 0 0 auto;
  width: 26px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.emp-arrow:hover {
  background: transparent;
  color: var(--ink);
}

.emp-card-list {
  display: flex;
  gap: 12px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 6px 8px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.emp-card-list::-webkit-scrollbar {
  display: none;
}

.emp-card-list.fade-left.fade-right {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
}

.emp-card-list.fade-left:not(.fade-right) {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 100%);
}

.emp-card-list.fade-right:not(.fade-left) {
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent 100%);
}

.emp-card {
  flex: 0 0 156px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 12px 14px;
  min-height: 184px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  font-weight: 400;
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    transform 0.14s ease;
}

.emp-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}

.emp-card.active {
  border: 2px solid var(--accent);
  padding: 19px 11px 13px;
}

.emp-card-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
}

.emp-card-avatar {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 700;
}

.emp-card-alert {
  position: absolute;
  top: -5px;
  right: -7px;
  width: 24px;
  height: 22px;
  display: grid;
  place-items: end center;
  padding-bottom: 2px;
  color: #4b3200;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #f6c343;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.emp-card-note {
  width: 100%;
  margin-top: -6px;
  padding: 5px 7px;
  border-radius: 8px;
  background: color-mix(in srgb, #f6c343 26%, transparent);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.emp-card-name {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
}

.emp-pill {
  display: inline-block;
  margin-top: auto;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.emp-reminders {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.emp-reminders-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.emp-reminder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 12px;
}

.emp-reminder-row.soon {
  border-color: color-mix(in srgb, #f6c343 70%, var(--line));
  background: color-mix(in srgb, #f6c343 22%, var(--surface));
}

.emp-reminder-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emp-reminder-row strong {
  flex: 0 0 auto;
  font-size: 11px;
}

.emp-reminder-editor {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.emp-reminder-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.emp-reminder-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 142px 30px 30px;
  gap: 8px;
  align-items: center;
}

.emp-reminder-edit-row input,
.emp-reminder-edit-row .dp-trigger {
  min-width: 0;
  height: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
}

.emp-reminder-title-input {
  min-width: 0;
}

.emp-reminder-edit-row .shift-icon-btn {
  width: 30px;
  height: 30px;
}

.emp-reminder-edit-row input:focus,
.emp-reminder-edit-row .dp-trigger:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.emp-reminder-view-row {
  grid-template-columns: minmax(0, 1fr) 142px 30px 30px;
}

.emp-reminder-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.emp-pill-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  padding: 3px 24px 3px 12px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%231f7564' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.emp-pill-select:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.emp-profile {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.emp-profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.emp-profile-id {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.emp-profile-avatar {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
}

.emp-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.emp-name-row h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
}

.emp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.emp-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.ghost-btn:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.ghost-btn.icon {
  width: 34px;
  padding: 0;
  color: var(--muted);
}

.ghost-btn.ghost-danger {
  color: var(--danger);
}

.ghost-btn.ghost-danger:hover {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--danger);
}

.emp-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.emp-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.emp-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.emp-stat strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.emp-stat strong em {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.emp-stat-note {
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.emp-stat-switch {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.emp-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.emp-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.emp-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 34%, var(--surface));
  transition: background 0.15s ease;
}

.emp-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s ease;
}

.emp-switch input:checked + span {
  background: var(--accent);
}

.emp-switch input:checked + span::after {
  transform: translateX(18px);
}

.emp-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.emp-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.emp-col h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.emp-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.emp-add-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: -12px -8px -4px 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
}

.emp-add-btn:hover {
  background: transparent;
  color: var(--accent);
}

.emp-toggle {
  align-self: flex-start;
  margin-top: 2px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.emp-toggle:hover {
  text-decoration: underline;
}

.emp-edit-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.emp-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.emp-edit-row .dp-field,
.emp-edit-row .emp-edit-range {
  flex: 1 1 auto;
  min-width: 0;
}

.emp-edit-row select[data-vac-field="type"],
.emp-edit-row .emp-edit-type {
  flex: 0 0 auto;
  min-width: 120px;
}

.emp-edit-row .shift-icon-btn {
  flex: 0 0 auto;
}

.emp-edit-static {
  font-size: 13px;
}

.emp-edit-range {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emp-edit-type {
  color: var(--muted);
}

.emp-edit-row input,
.emp-edit-row select {
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 8px;
}

.emp-row-x {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.emp-row-x:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}

.emp-col .profile-grid {
  grid-template-columns: 1fr;
}

.emp-kv {
  display: flex;
  flex-direction: column;
}

.emp-kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.emp-kv-row:first-child {
  border-top: 0;
}

.emp-kv-row span {
  color: var(--muted);
}

.emp-kv-row strong {
  color: var(--ink);
  font-weight: 600;
}

.emp-vac-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.emp-vac-line strong {
  font-size: 14px;
}

.emp-vac-line span {
  color: var(--muted);
  font-size: 12px;
}

.emp-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.emp-rows {
  display: flex;
  flex-direction: column;
}

.emp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.emp-row:first-child {
  border-top: 0;
}

.emp-row span {
  color: var(--muted);
}

.emp-row strong {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.emp-empty {
  color: var(--muted);
  font-size: 13px;
}

.emp-shiftpref {
  padding: 14px;
  border: 1px solid var(--line, #e2e8e5);
  border-radius: 14px;
  background: var(--card, #fff);
  margin-bottom: 14px;
}
.emp-shiftpref .emp-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.shiftpref-note { font-size: 12px; font-weight: 600; color: var(--muted); }
.shiftpref-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.shiftpref-end { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.shiftpref-slider {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

.emp-availability {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.emp-availability h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.emp-avail-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}

.emp-avail-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 96px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.emp-lock {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.emp-avail-chip .emp-lock {
  position: absolute;
  top: 8px;
  right: 8px;
}

.emp-col-head .emp-lock {
  margin-left: auto;
}

.emp-avail-chip span {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.emp-avail-chip strong {
  display: grid;
  place-items: center;
  min-height: 30px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.emp-avail-chip.off strong {
  color: var(--muted);
  font-weight: 400;
}

.emp-avail-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 96px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.emp-avail-box.active {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--surface);
}

.emp-avail-box.off {
  align-items: stretch;
  justify-content: space-between;
}

.emp-avail-box-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.emp-avail-box-day {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.emp-avail-check {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.emp-avail-check input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}

.emp-avail-check input:checked {
  border-color: transparent;
  background: var(--accent-soft);
}

.emp-avail-check input:checked::after {
  content: "✓";
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.emp-avail-copy {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.emp-avail-copy:hover {
  color: var(--accent);
}

.emp-avail-times {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 4px;
}

.emp-avail-times input {
  flex: 1 1 0;
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 2px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.emp-avail-sep {
  color: var(--muted);
  font-size: 12px;
}

.emp-avail-frei {
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  min-height: 30px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 920px) {
  .emp-columns {
    grid-template-columns: 1fr;
  }
  .emp-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .emp-avail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@keyframes empFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#employeesView.active,
#settingsView.active {
  animation: empFadeIn 0.3s ease;
}

#plannerView.active .metrics {
  animation: empFadeIn 0.4s ease;
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.planner-table tbody.rows-stagger tr:not(.planner-spacer-row) {
  animation: rowIn 0.5s both cubic-bezier(0.22, 1, 0.36, 1);
  animation-delay: calc(var(--i, 0) * 70ms);
}

.hours-table tbody.rows-stagger tr {
  animation: rowIn 0.5s both cubic-bezier(0.22, 1, 0.36, 1);
  animation-delay: calc(var(--i, 0) * 70ms);
}

.planner-table .planner-spacer-row td {
  height: 16px;
  border: 0;
  background: var(--surface);
  padding: 0;
}

.planner-footer-toggle {
  width: 100%;
  height: 16px;
  display: grid;
  place-items: center;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
}

.planner-footer-toggle:hover,
.planner-spacer-row.open .planner-footer-toggle {
  background: var(--surface-muted);
  color: var(--ink);
}

.planner-footer-comments-row td {
  height: 58px;
  padding: 6px 0;
  border: 0;
  background: var(--surface);
}

.planner-footer-comments-row textarea {
  width: 100%;
  min-height: 46px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--ink);
  padding: 6px 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.planner-footer-comments-row textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

@keyframes empCardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.emp-card-list.cards-stagger .emp-card {
  animation: empCardIn 0.38s both ease;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.shift-list.cards-stagger .shift-li {
  animation: empCardIn 0.36s both ease;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.shift-day-grid.cards-stagger .shift-day {
  animation: empCardIn 0.34s both ease;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
}

.autoplan-log-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding: 14px;
}

.autoplan-log-empty {
  padding: 4px 0;
}

.apl-item {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.apl-item.ok {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.apl-item.warn {
  border-color: color-mix(in srgb, var(--warning) 36%, var(--line));
}

.apl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.apl-head div {
  display: grid;
  gap: 2px;
}

.apl-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.apl-head span,
.apl-item p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.apl-head b {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
}

.apl-item.warn .apl-head b {
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
  color: var(--warning);
}

.apl-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.apl-grid span {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.apl-grid b {
  color: var(--ink);
}

.apl-section {
  display: grid;
  gap: 5px;
}

.apl-section strong {
  font-size: 12px;
  color: var(--ink);
}

.apl-section ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 17px;
  color: var(--muted);
  font-size: 12px;
}

.apl-section.done li {
  color: var(--accent);
}

.apl-section.open li,
.apl-section.missing li {
  color: var(--warning);
}

.watermark-preview {
  display: grid;
  min-height: 92px;
  margin: 14px 14px 0;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 55%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 55%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--line) 55%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--line) 55%, transparent) 75%),
    var(--surface);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
}

.watermark-preview img {
  max-width: 100%;
  max-height: 88px;
  object-fit: contain;
}

.data-import-label {
  display: inline-flex;
  align-items: center;
  margin-top: 0;
  cursor: pointer;
}

/* Datei-Auswahl-Label im Stil der Standard-Buttons (wie "Exportieren"). */
.btn-primary-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.btn-primary-label:hover {
  filter: brightness(0.9);
}

/* Buttons in den Aktionsleisten gleich groß und auf einer Linie. */
.data-actions .subtle-button,
.data-actions .btn-primary-label,
.data-actions button {
  margin-top: 0;
  min-height: 34px;
  font-size: 13px;
}

#dataStatus {
  padding: 0 14px 14px;
}

#watermarkStatus {
  margin: 8px 0 0;
  padding: 0 14px 14px;
}

/* Wiederkehrende Termine */
.recurring-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  align-items: center;
}

/* Editbox + beide Comboboxen gleich groß und im Webseiten-Stil */
.recurring-form .rc-control {
  flex: 1 1 0;
  min-width: 150px;
  box-sizing: border-box;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
}

.recurring-form select.rc-control {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2368736f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.recurring-form .rc-control:focus,
.recurring-form .rc-control.cs-open {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Multi-Wochentag-Trigger sieht aus wie eine Combobox */
.rc-multi {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}

.rc-multi .rc-multi-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.rc-multi.has-value .rc-multi-label {
  color: var(--ink);
  font-weight: 600;
}

.rc-multi .rc-multi-arrow {
  flex: 0 0 auto;
  color: var(--muted);
}

/* Checkbox-Option im Dropdown */
.cs-opt.cs-check .cs-checkbox {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 900;
  color: var(--accent-ink);
  background: var(--surface);
}

.cs-opt.cs-check.sel .cs-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.recurring-form button:not(.rc-control) {
  min-height: 36px;
  font-size: 13px;
}

.recurring-list {
  list-style: none;
  margin: 0;
  padding: 0 14px 14px;
  display: grid;
  gap: 8px;
}

.recurring-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.recurring-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--appointment-accent, #2563eb);
}

.recurring-name {
  font-weight: 800;
  font-size: 13px;
}

.recurring-meta {
  color: var(--muted);
  font-size: 12px;
}

.recurring-remove {
  flex: 0 0 auto;
  margin-left: auto;
}

.recurring-remove:hover {
  color: var(--danger);
}

.recurring-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 4px 2px;
}

.appointment-code-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 14px 14px 10px;
}

.appointment-code-input {
  flex: 1 1 180px;
  min-width: 140px;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.appointment-code-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.appointment-code-form button {
  min-height: 34px;
  padding: 0 14px;
  font-size: 12px;
}

.appointment-code-status {
  display: none;
  margin: 0;
  padding: 0 14px 8px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.appointment-code-status.show {
  display: block;
}

.appointment-code-list {
  list-style: none;
  margin: 0;
  padding: 0 14px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.appointment-code-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 9px 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.appointment-code-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  color: var(--muted);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transform: translateY(0.5px);
}

.appointment-code-remove svg {
  display: block;
}

.appointment-code-remove:hover {
  color: var(--danger);
}

.appointment-code-remove:focus-visible {
  outline: none;
  color: var(--danger);
  text-decoration: underline;
}

/* Kommentarfeld mit wiederkehrendem Termin hervorheben (blau) */
.planner-table .comment-cell.has-appointment {
  background: #e6f0fe;
}

@media (prefers-color-scheme: dark) {
  .planner-table .comment-cell.has-appointment {
    background: #16314f !important;
  }
}

.availability-panel {
  margin-top: 16px;
}

.inline-field {
  display: grid;
  gap: 5px;
  min-width: 220px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.employee-table th,
.employee-table td,
.availability-table th,
.availability-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  height: 40px;
  padding: 5px 6px;
  text-align: left;
}

.employee-table th,
.availability-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.employee-table tbody tr:hover,
.availability-table tbody tr:hover {
  background: #f8fcfb;
}

.employee-table .number-col {
  width: 92px;
}

.employee-table .date-col {
  width: 132px;
}

.employee-table input:not([type="checkbox"]),
.employee-table select,
.employee-table .dp-trigger {
  height: 32px;
  border-color: transparent;
  background: transparent !important;
  box-shadow: none;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.employee-table input:not([type="checkbox"]):hover,
.employee-table input:not([type="checkbox"]):focus,
.employee-table select:hover,
.employee-table select:focus,
.employee-table .dp-trigger:hover,
.employee-table .dp-field[data-dp-field] .dp-trigger[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--surface-muted) !important;
  box-shadow: 0 0 0 3px rgba(67, 182, 157, 0.12);
  outline: none;
}

.employee-table .dp-trigger {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
}

.employee-table .dp-icon {
  width: 15px;
  height: 15px;
}

.employee-table .dp-display {
  font-size: 12px;
}

.employee-table .free-col input[type="checkbox"] {
  appearance: none;
  width: 26px;
  height: 26px;
  min-width: 26px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.employee-table .free-col input[type="checkbox"]:hover,
.employee-table .free-col input[type="checkbox"]:focus-visible {
  border-color: var(--line);
  background: var(--surface-muted);
  box-shadow: 0 0 0 3px rgba(67, 182, 157, 0.12);
  outline: none;
}

.employee-table .free-col input[type="checkbox"]:checked {
  border-color: var(--accent);
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.3 8.2 6.6 11.4 12.9 4.7' fill='none' stroke='white' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 16px 16px no-repeat,
    var(--accent);
}

.employee-table .total-col {
  color: var(--ink);
  font-weight: 850;
  text-align: right;
}

.employee-table .action-col {
  width: 70px;
  text-align: center;
}

.availability-table .day-name {
  width: 140px;
  font-weight: 850;
}

.availability-table .free-col {
  width: 82px;
  text-align: center;
}

.availability-table .free-col input {
  min-width: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.danger-button {
  min-height: 28px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 850;
}

.danger-button:hover {
  background: #ffe4e6;
}

.shift-times {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 11px 12px 12px;
  border-top: 1px solid var(--line);
}

.shift-times span {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  padding: 6px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rules {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px 18px 0;
}

.rules .rule-card {
  display: grid;
  gap: 8px;
  min-height: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  padding: 0;
}

.rules span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.rule-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-value input {
  width: 78px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 16px;
  font-weight: 800;
}

.rule-value input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-color: var(--accent);
}

.rule-value em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
}

.settings-section-head {
  padding: 12px 12px 0;
}

.settings-section-head h3 {
  margin: 0;
  font-size: 14px;
}

.settings-section-head .panel-subtitle {
  margin-top: 2px;
}

.shift-catalog {
  display: grid;
  gap: 10px;
  padding: 10px 12px 4px;
}

.catalog-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.catalog-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.catalog-group-head strong {
  font-size: 13px;
}

.catalog-add {
  margin-top: 0;
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.catalog-rows {
  display: grid;
  gap: 6px;
}

.catalog-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 64px 64px 28px;
  gap: 6px;
  align-items: center;
}

.catalog-row input {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
  font-weight: 700;
}

.catalog-row .catalog-code {
  text-transform: uppercase;
  text-align: center;
}

.catalog-row .catalog-time {
  text-align: center;
}

.catalog-row input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-color: var(--accent);
}

.catalog-row .row-delete {
  width: 28px;
  height: 28px;
}

.catalog-item {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.catalog-item .catalog-row {
  align-items: center;
}

.catalog-overrides {
  display: grid;
  gap: 6px;
  padding-left: 10px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

.catalog-override {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 64px 28px;
  gap: 6px;
  align-items: center;
}

.catalog-override select,
.catalog-override input {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 8px;
  font-weight: 700;
}

.catalog-override .catalog-time {
  text-align: center;
}

.override-add {
  justify-self: start;
  margin-top: 0;
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.field-block {
  display: grid;
  gap: 6px;
  padding: 0 18px;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.conn-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  padding: 0 18px 16px;
}

.conn-fields .field-block {
  padding: 0;
}

.conn-fields .conn-key {
  grid-column: 1 / -1;
}

.field-block input {
  width: 100%;
  height: 38px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 600;
}

.field-block select {
  width: 100%;
  height: 38px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.holiday-list {
  margin: 12px 0 0;
  padding: 0 18px 18px;
  list-style: none;
  display: grid;
  gap: 2px;
  color: var(--ink);
  font-size: 13px;
}

.holiday-list li {
  display: flex;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.holiday-list li:last-child {
  border-bottom: none;
}

.holiday-date {
  flex: none;
  width: 96px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.holiday-name {
  font-weight: 600;
}

.staffing-rules {
  margin: 10px 18px 18px;
  width: calc(100% - 36px);
  border-collapse: collapse;
}

.staffing-rules th,
.staffing-rules td {
  border-bottom: 1px solid var(--line);
  height: 44px;
  padding: 0 6px;
  text-align: center;
  font-size: 13px;
}

.staffing-rules input[type="number"] {
  -moz-appearance: textfield;
}

.staffing-rules input[type="number"]::-webkit-outer-spin-button,
.staffing-rules input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
  opacity: 0;
}

.staffing-rules td:hover input[type="number"] {
  -moz-appearance: number-input;
}

.staffing-rules td:hover input[type="number"]::-webkit-inner-spin-button,
.staffing-rules td:hover input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: auto;
  opacity: 1;
}

.staffing-rules tr:last-child td {
  border-bottom: none;
}

.staffing-rules input {
  width: 56px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-weight: 600;
}

.staffing-rules input:hover,
.staffing-rules input:focus {
  border-color: var(--line);
  background: var(--surface);
  outline: none;
}

.staffing-rules th {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.staffing-rules td:first-child,
.staffing-rules th:first-child {
  text-align: left;
}

/* Dropdown-Kalender aus dem Personal-Dashboard */
.dp-field {
  position: relative;
  display: block;
  width: 100%;
}

.dp-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.dp-trigger:hover,
.dp-field[data-dp-field] .dp-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dp-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dp-display {
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dp-display.dp-placeholder {
  color: var(--muted);
}

.dp-popup {
  position: fixed;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 16px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(20, 31, 28, 0.14);
  animation: dpPopIn 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes dpPopIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.dp-title {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 6px;
}

.dp-sel-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
}

.dp-sel-month {
  flex: 1.25 1 0;
}

.dp-sel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  height: 34px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.dp-sel:hover,
.dp-sel[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dp-sel-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dp-sel-arrow {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 150ms ease;
}

.dp-sel[aria-expanded="true"] .dp-sel-arrow {
  transform: rotate(180deg);
}

.dp-sel-menu {
  position: absolute;
  inset: calc(100% + 4px) 0 auto 0;
  z-index: 5;
  max-height: 220px;
  margin: 0;
  padding: 5px;
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(20, 31, 28, 0.2);
}

.dp-sel-menu[hidden] {
  display: none;
}

.dp-sel-opt {
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.dp-sel-opt:hover {
  background: var(--accent-soft);
}

.dp-sel-opt.sel {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.dp-nav {
  display: flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.dp-nav:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

.dp-nav:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.dp-range-hint {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.dp-weekdays,
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.dp-weekdays {
  gap: 2px;
  margin-bottom: 6px;
}

.dp-weekdays span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.dp-grid {
  gap: 4px;
}

.dp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.dp-day:hover:not(.dp-past):not(.dp-empty) {
  background: var(--accent-soft);
  color: var(--accent);
}

.dp-day.dp-today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  font-weight: 800;
}

.dp-day.dp-holiday {
  background: rgba(217, 151, 36, 0.13);
  color: var(--warning);
}

.dp-day.dp-selected {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.dp-day.dp-empty,
.dp-day.dp-past {
  pointer-events: none;
}

.dp-day.dp-past {
  visibility: hidden;
}

.dp-in-range {
  border-radius: 0 !important;
  background: var(--accent-soft);
}

.dp-range-start {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.dp-range-end {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.dp-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.dp-clear,
.dp-today-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.dp-today-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.dp-clear:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.dp-popup.dp-popup-sheet {
  position: fixed;
  left: 50% !important;
  top: 50% !important;
  width: min(360px, calc(100vw - 24px));
  transform: translate(-50%, -50%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513;
    --surface: #171d1b;
    --surface-muted: #202a27;
    --ink: #edf3f1;
    --muted: #9aa8a4;
    --line: #2a3632;
    --line-strong: #42504c;
    --accent-soft: #173a33;
    --primary-soft: #173a33;
    --danger-soft: #3a1d1b;
    --weekend: rgba(255, 255, 255, 0.08);
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  }

  .topbar,
  .tabs,
  .planner-head,
  .panel-head,
  .planner-shell,
  .panel,
  .metric,
  .brand::before,
  .switch-field,
  .year-switch,
  .year-switch .year-step,
  #resetButton,
  .subtle-button,
  .plan-add-control select,
  .chip,
  .planner-table .name-head,
  .planner-table .employee,
  .planner-table .role-head,
  .planner-table .role-cell,
  .planner-table input:focus,
  .planner-table .occupancy-label,
  .vacation-row select,
  .vacation-row input,
  .inline-field select,
  .employee-table input,
  .employee-table select,
  .availability-table input,
  .staffing-rules input,
  .shift-times span,
  .rules div,
  .dp-trigger,
  .dp-popup,
  .dp-sel-menu {
    background: var(--surface) !important;
    color: var(--ink);
  }

.employee-table input:not([type="checkbox"]),
.employee-table select,
.employee-table .dp-trigger {
  border-color: transparent;
  background: transparent !important;
  box-shadow: none;
}

.employee-table input:not([type="checkbox"]):hover,
.employee-table input:not([type="checkbox"]):focus,
.employee-table select:hover,
.employee-table select:focus,
.employee-table .dp-trigger:hover,
.employee-table .dp-field[data-dp-field] .dp-trigger[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--surface-muted) !important;
  box-shadow: 0 0 0 3px rgba(67, 182, 157, 0.12);
}

.employee-table .free-col input[type="checkbox"] {
  border-color: transparent;
  background: transparent !important;
}

.employee-table .free-col input[type="checkbox"]:hover,
.employee-table .free-col input[type="checkbox"]:focus-visible {
  border-color: var(--line);
  background: var(--surface-muted) !important;
}

.employee-table .free-col input[type="checkbox"]:checked {
  border-color: var(--accent);
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.3 8.2 6.6 11.4 12.9 4.7' fill='none' stroke='white' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 16px 16px no-repeat,
    var(--accent) !important;
}

.staffing-rules input {
  border-color: transparent;
  background: transparent !important;
}

.staffing-rules input:hover,
.staffing-rules input:focus {
  border-color: var(--line);
  background: var(--surface-muted) !important;
}

.toolbar {
  border-top-color: var(--line);
}

.brand::before {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--accent-soft) !important;
  color: var(--accent);
}

.metric,
.planner-shell,
.panel {
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.planner-head,
.panel-head {
  border-bottom-color: var(--line);
}

.planner-table th,
.planner-table .name-head,
.planner-table .role-head,
.balance-table th,
.employee-table th,
.availability-table th,
.staffing-rules th {
  background: #1d2522 !important;
  color: var(--muted);
}

.planner-table th,
.planner-table td,
.balance-table th,
.balance-table td,
.employee-table th,
.employee-table td,
.availability-table th,
.availability-table td,
.staffing-rules th,
.staffing-rules td {
  border-color: var(--line) !important;
}

.planner-table .summary-head,
.planner-table .summary,
.planner-table tfoot th,
.planner-table tfoot td,
.planner-table .occupancy-total,
.balance-table th,
.employee-table th,
.availability-table th,
.staffing-rules th,
.dp-sel,
.dp-nav,
.dp-clear,
.vacation-remove {
  background: var(--surface-muted) !important;
  color: var(--ink);
}

.planner-table:not(.occupancy-table) tbody tr:hover td:not(.employee):not(.pm-cell):not(.role-cell),
.employee-table tbody tr:hover,
.availability-table tbody tr:hover {
  background: #1b2724 !important;
}

.planner-table input:hover {
  background: rgba(67, 182, 157, 0.12);
}

.planner-table .missing {
  background: rgba(224, 111, 99, 0.18) !important;
  color: var(--danger);
  box-shadow: inset 0 0 0 1px rgba(224, 111, 99, 0.45);
}

.row-delete,
.danger-button {
  border-color: rgba(224, 111, 99, 0.36);
  background: var(--danger-soft) !important;
  color: var(--danger);
}

.row-delete:hover,
.danger-button:hover {
  background: #4a2420 !important;
}

.vacation-remove:hover {
  background: #2a3632 !important;
}

.holiday {
  color: #ffd875;
}

.weekend {
  color: var(--ink);
}

.dp-trigger:hover,
.dp-field[data-dp-field] .dp-trigger[aria-expanded="true"],
.dp-sel:hover,
.dp-sel[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(67, 182, 157, 0.18);
}

.dp-sel-opt:hover,
.dp-day:hover:not(.dp-past):not(.dp-empty),
.dp-clear:hover {
  background: var(--accent-soft) !important;
  color: var(--accent);
}

.dp-sel-opt.sel,
.dp-day.dp-selected,
.dp-today-btn {
  background: var(--accent) !important;
  color: #ffffff;
}

.dp-day.dp-holiday {
  background: rgba(216, 164, 65, 0.18);
  color: var(--warning);
}
}

@media (max-width: 1100px) {
  :root {
    --name-col: 154px;
    --day-col: 32px;
    --summary-col: 24px;
  }

  .metrics,
  .bottom-grid,
  .settings-layout {
    grid-template-columns: 1fr 1fr;
  }

  main {
    max-width: 100%;
  }

  .panel,
  .planner-shell {
    border-radius: 10px;
  }

  .report-table .report-name-col {
    width: 172px;
  }

  .report-table .report-month-col {
    width: 58px;
  }

  .report-table .report-name {
    width: 172px;
    min-width: 172px;
    max-width: 172px;
  }

  .profile-main {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .bottom-grid .panel:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  :root {
    --name-col: 138px;
    --role-col: 34px;
    --day-col: 28px;
    --summary-col: 22px;
  }

  .topbar,
  .planner-head,
  .panel-head {
    align-items: stretch;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand avatar" "tabs tabs";
    gap: 10px 12px;
    padding: 8px 16px;
    align-items: center;
  }

  .brand { grid-area: brand; min-width: 0; }
  .topbar .tabs { grid-area: tabs; justify-self: stretch; overflow-x: auto; flex-wrap: nowrap; }
  .topbar [data-userbar-slot] { grid-area: avatar; justify-self: end; }

  .toolbar,
  .shift-palette {
    justify-content: flex-start;
    justify-items: start;
  }

  main {
    padding: 12px;
  }

  button,
  .subtle-button,
  .data-import-label,
  select,
  input,
  .dp-trigger {
    min-height: 44px;
  }

  .toolbar {
    gap: 8px;
  }

  .toolbar button,
  .employee-head-actions button,
  .employee-head-actions .subtle-button,
  .data-actions button,
  .data-actions .subtle-button {
    min-height: 42px;
    padding-inline: 12px;
  }

  .panel-head {
    flex-direction: column;
    gap: 10px;
    padding: 13px 14px;
  }

  .employee-head-actions,
  .data-actions {
    width: 100%;
    justify-content: stretch;
  }

  .employee-head-actions button,
  .employee-head-actions .subtle-button,
  .data-actions button,
  .data-actions .subtle-button {
    flex: 1 1 150px;
    justify-content: center;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tabs {
    justify-self: start;
    gap: 18px;
  }

  .metrics,
  .bottom-grid,
  .profile-main,
  .profile-grid,
  .profile-stats,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .employee-card-list {
    grid-auto-columns: 150px;
  }

  .report-table .report-name-col {
    width: 156px;
  }

  .report-table .report-sum-col {
    width: 46px;
  }

  .report-table .report-month-col {
    width: 48px;
  }

  .report-table .report-name {
    width: 156px;
    min-width: 156px;
    max-width: 156px;
  }

  .report-month-card {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .report-calendar-table .report-calendar-name-col,
  .report-calendar-table tbody th,
  .report-calendar-table thead .report-calendar-name {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
  }

  .report-calendar-table .report-calendar-day-col,
  .report-calendar-table th,
  .report-calendar-table td,
  .report-calendar-table thead th {
    min-width: 24px;
  }

  .profile-head,
  .profile-title {
    align-items: flex-start;
  }

  .profile-head {
    flex-direction: column;
  }

  .profile-availability {
    grid-auto-flow: column;
    grid-auto-columns: 84px;
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .bottom-grid .panel:last-child {
    grid-column: auto;
  }

  .vacation-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Dark-Mode-Korrekturen (Kacheln, Planner, Mobile) ===== */
@media (prefers-color-scheme: dark) {
  .metric-icon.mi-blue { background: rgba(59, 130, 246, 0.18); color: #93b8ff; }
  .metric-icon.mi-cyan { background: rgba(14, 148, 136, 0.22); color: #6fd6cb; }
  .metric-icon.mi-amber { background: rgba(216, 144, 42, 0.22); color: #f0b968; }
  .metric-icon.mi-green { background: rgba(46, 158, 79, 0.22); color: #7fd496; }
  .metric-icon.mi-purple { background: rgba(124, 92, 214, 0.24); color: #bca6f2; }

  .planner-table .name-head,
  .planner-table .employee,
  .planner-table .pm-head,
  .planner-table .pm-cell,
  .planner-table .role-head,
  .planner-table .role-cell,
  .planner-table .comment-cell,
  .planner-table #plannerCorner {
    background: var(--surface);
  }

  .planner-table .name-head,
  .planner-table .pm-head,
  .planner-table .role-head {
    background: #1b2320;
  }

  .planner-table .pm-cell.pos {
    color: #7fd496;
  }

  .planner-table .pm-cell.neg {
    color: #f1a3a3;
  }

  .planner-table .summary-head,
  .planner-table .summary {
    background: #1b2320;
    color: var(--ink);
  }

  .planner-table .gap-cell,
  .planner-table .planner-spacer-row td {
    background: var(--surface);
  }

  .occupancy-table th,
  .occupancy-table td {
    background: var(--surface);
  }

  .occupancy-table .occupancy-label,
  .occupancy-table .occupancy-total {
    background: var(--surface-muted);
  }

  .occupancy-table td.missing .occ-val {
    background: rgba(224, 111, 99, 0.28);
    color: #f3b4ad;
  }
}

@media (max-width: 760px) {
  .conn-fields {
    grid-template-columns: 1fr;
  }
  .conn-fields .conn-key {
    grid-column: auto;
  }
}

/* ===== Stundendifferenzen ===== */
.hours-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.hours-table th,
.hours-table td {
  box-sizing: border-box;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  height: 42px;
  min-width: 56px;
  padding: 0;
  text-align: center;
}

.hours-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hours-table .hd-name,
.hours-table thead .hd-name {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 210px;
  max-width: 210px;
  text-align: left;
  background: #fff;
}

.hours-table thead .hd-name {
  z-index: 4;
  background: #f8fafc;
  padding: 0 10px;
  vertical-align: middle;
}

.hours-table td.hd-name {
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hours-table td.hd-name .emp-cell-avatar {
  vertical-align: middle;
  margin-right: 8px;
}

.hours-table td.hd-name .hd-name-text {
  vertical-align: middle;
  font-weight: 700;
}

.hours-table .hd-corr,
.hours-table .hd-diff,
.hours-table .hd-diff-head {
  min-width: 84px;
}

.hours-table .hd-input {
  width: 100%;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-size: 13px;
  font-weight: 400;
}

.hours-table .hd-input::-webkit-outer-spin-button,
.hours-table .hd-input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.hours-table .hd-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.hours-table .hd-input:hover,
.hours-table .hd-input:focus {
  outline: 0;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.hours-table .hd-diff {
  font-weight: 400;
  font-size: 14px;
  background: #fbfcfd;
}

.hours-table .hd-diff span,
.hours-table .hd-diff em {
  display: inline-block;
  vertical-align: baseline;
}

.hours-table .hd-diff em {
  margin-left: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.hours-table .hd-diff.pos {
  color: #2e9e4f;
}

.hours-table .hd-diff.neg {
  color: var(--danger);
}

/* ===== Berichte ===== */
.reports-panel {
  max-width: 1360px;
  margin: 0 auto;
}

.reports-grid {
  display: grid;
  gap: 18px;
}

.report-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.report-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-muted) 65%, var(--surface));
}

.report-card-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.report-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.report-table,
.report-calendar-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.report-table .report-name-col {
  width: 190px;
}

.report-table .report-sum-col {
  width: 52px;
}

.report-table .report-month-col {
  width: 68px;
}

.report-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.report-table th,
.report-table td,
.report-calendar-table th,
.report-calendar-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  height: 34px;
  padding: 0 8px;
  text-align: center;
  color: var(--ink);
  font-size: 13px;
}

.report-table tbody th,
.report-table tbody td {
  background: var(--surface);
}

.report-table thead th,
.report-calendar-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-table .report-name,
.report-calendar-table tbody th,
.report-calendar-name {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  background: var(--surface);
  text-align: left;
  white-space: nowrap;
}

.report-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.report-name-cell .emp-cell-avatar {
  flex: 0 0 22px;
  width: 22px;
  min-width: 22px;
  max-width: 22px;
  height: 22px;
  min-height: 22px;
  font-size: 8px;
}

.report-name-cell span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-table thead .report-name,
.report-calendar-table thead .report-calendar-name {
  z-index: 4;
  background: #f8fafc;
}

.report-table tbody th {
  font-weight: 800;
}

.report-table .report-sum {
  min-width: 52px;
  font-weight: 800;
}

.report-table .report-zero {
  color: var(--muted);
}

.report-table tbody td:not(.report-zero):not(.report-sum) {
  font-weight: 800;
}

.report-year {
  display: grid;
  gap: 16px;
  padding: 14px;
}

.report-month-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.report-month-title {
  display: grid;
  place-items: center;
  background: var(--accent-strong);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.report-month-card .table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.report-calendar-table {
  width: 100%;
  table-layout: fixed;
  border-top: 0;
  border-left: 0;
}

.report-calendar-table .report-calendar-name-col {
  width: 220px;
}

.report-calendar-table .report-calendar-day-col {
  width: calc((100% - 220px) / 31);
}

.report-calendar-table th,
.report-calendar-table td {
  height: 24px;
  width: calc((100% - 220px) / 31);
  min-width: 26px;
  max-width: none;
  padding: 0 3px;
  font-size: 11px;
}

.report-calendar-table thead th {
  height: 34px;
  width: calc((100% - 220px) / 31);
  min-width: 26px;
  max-width: none;
  padding: 0 2px;
}

.report-calendar-table tbody th,
.report-calendar-table thead .report-calendar-name {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
}

.report-calendar-table thead th span,
.report-calendar-table thead th em {
  display: block;
  font-style: normal;
  line-height: 1.15;
}

.report-calendar-table thead th em {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

.report-calendar-table .weekend {
  background: color-mix(in srgb, var(--muted) 17%, var(--surface));
}

.report-calendar-table .holiday {
  background: var(--holiday);
}

.report-calendar-table .out-month {
  background: var(--surface);
  border-right-color: transparent;
  border-bottom-color: transparent;
  color: transparent;
}

.report-calendar-table td.vacation {
  background: color-mix(in srgb, #22c55e 75%, var(--surface));
  color: #052e16;
  font-weight: 900;
}

.report-calendar-table td.sick {
  background: color-mix(in srgb, var(--danger) 72%, var(--surface));
  color: #fff;
  font-weight: 900;
}

.report-calendar-table td.other {
  background: color-mix(in srgb, #f59e0b 70%, var(--surface));
  color: #3b2600;
  font-weight: 900;
}

.report-calendar-table tbody tr:hover th,
.report-calendar-table tbody tr:hover td,
.report-table tbody tr:hover th,
.report-table tbody tr:hover td {
  background-color: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.report-calendar-table tbody tr:hover td.vacation {
  background: color-mix(in srgb, #22c55e 78%, var(--surface));
}

.report-calendar-table tbody tr:hover td.sick {
  background: color-mix(in srgb, var(--danger) 78%, var(--surface));
}

.report-calendar-table tbody tr:hover td.other {
  background: color-mix(in srgb, #f59e0b 76%, var(--surface));
}

.report-table tbody.rows-stagger tr,
.report-calendar-table tbody.rows-stagger tr {
  animation: rowIn 0.5s both cubic-bezier(0.22, 1, 0.36, 1);
  animation-delay: calc(var(--i, 0) * 45ms);
}

@media (prefers-color-scheme: dark) {
  .hours-table thead th,
  .hours-table thead .hd-name {
    background: #1b2320;
  }
  .hours-table .hd-name {
    background: var(--surface);
  }
  .hours-table .hd-diff {
    background: #1b2320;
  }
  .hours-table .hd-diff.pos {
    color: #7fd496;
  }
  .report-table thead th,
  .report-table thead .report-name,
  .report-calendar-table thead th,
  .report-calendar-table thead .report-calendar-name {
    background: #1b2320;
  }
  .report-table .report-name,
  .report-calendar-table tbody th,
  .report-calendar-name {
    background: var(--surface);
  }
  .report-table .report-sum {
    background: #26312d;
  }
}

/* Dark-Mode: "Mitarbeiter hinzufügen"-Combobox unsichtbar lassen */
@media (prefers-color-scheme: dark) {
  .planner-controls .plan-add-control select {
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none;
  }
  .planner-controls .plan-add-control select:hover {
    background-color: var(--surface) !important;
    border-color: var(--line) !important;
  }
}

/* Jahr-Schalter Stundendifferenz exakt wie Dienstplan-Schalter */
#hoursView .year-switch .year-current,
#reportsView .year-switch .year-current {
  min-width: 96px;
  font-size: 14px;
  font-weight: 700;
}

/* ===== Auth/Userbar – aus Personal Dashboard übernommen ===== */
/* ============================================================
   Authentifizierung: Login / Erst-Einrichtung / Adminbereich
   ============================================================ */
.auth-host { position: fixed; inset: 0; z-index: 4000; opacity: 1; }
.auth-host.auth-anim { opacity: 0; transition: opacity 280ms ease; }
.auth-host.auth-anim.auth-in { opacity: 1; }

.auth-host.auth-in { opacity: 1; }

.auth-screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
  background:
    radial-gradient(1200px 600px at 50% -10%, #f3ede0 0%, #efe9dd 38%, #e9e2d3 100%);
}

@media (prefers-color-scheme: dark) {
  .auth-screen { background: radial-gradient(1200px 600px at 50% -10%, #1c211f 0%, #161b1a 60%, #111514 100%); }
}

/* Hintergrundbild (Datei: assets/login-bg.png) – per Multiply über die Pergament-Farbe geblendet,
   damit die warme Farbe erhalten bleibt und nur die Zeichnung sichtbar wird. */
.auth-bg {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background: url("./assets/login-bg.png") center / cover no-repeat;
  mix-blend-mode: multiply; opacity: 0.62;
}

@media (prefers-color-scheme: dark) { .auth-bg { mix-blend-mode: screen; filter: invert(1); opacity: 0.32; } }

/* Karte */
.auth-card {
  position: relative; z-index: 1; width: min(420px, 100%);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px) saturate(1.05);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 20px; padding: 30px 28px;
  box-shadow: 0 24px 60px rgba(20, 31, 28, 0.18), inset 0 1px 0 rgba(255,255,255,0.5);
  transform: none; opacity: 1;
  animation: authRise 520ms cubic-bezier(0.2, 0.7, 0.2, 1) 120ms backwards;
}

.auth-card-modal { width: min(400px, 100%); }

.auth-brand { text-align: center; margin-bottom: 20px; }

.auth-logo { display: inline-flex; width: 52px; height: 52px; align-items: center; justify-content: center;
  border-radius: 15px; background: var(--accent); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 40%, transparent); }

.auth-logo svg { width: 28px; height: 28px; }

.auth-brand h1 { margin: 12px 0 2px; font-size: 21px; letter-spacing: -0.01em; }

.auth-brand p { margin: 0; color: var(--muted); font-size: 13px; }

.auth-form { display: grid; gap: 13px; }

.auth-field { display: grid; gap: 6px; }

.auth-field span { font-size: 12px; font-weight: 700; color: var(--muted); }

.auth-field input {
  height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink); font-size: 15px; transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

.auth-hint { margin: 2px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.auth-error { background: #fae5e2; color: #a3261f; border-radius: 10px; padding: 9px 12px; font-size: 13px; font-weight: 600; }

.auth-error[hidden] { display: none; }

.auth-row { display: flex; gap: 10px; align-items: stretch; margin-top: 8px; }

.auth-row .auth-submit, .auth-row .auth-secondary { flex: 1 1 0; min-width: 0; width: 100%; height: 44px; margin-top: 0; padding: 0; border-radius: 11px; font-size: 14px; font-weight: 700; box-sizing: border-box; }

.auth-row .auth-secondary { display: inline-flex; align-items: center; justify-content: center; }

.auth-submit {
  height: 46px; margin-top: 4px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
  transition: filter 140ms ease, transform 120ms ease;
}

.auth-submit:hover { filter: brightness(1.06); }

.auth-submit:active { transform: translateY(1px); }

.auth-submit:disabled, .auth-submit.is-busy { opacity: 0.65; cursor: progress; }

.auth-secondary { height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: 13px; cursor: pointer; }

.auth-secondary:hover { border-color: var(--accent); }

.auth-danger { height: 40px; padding: 0 14px; border: 1px solid #e7c3bd; border-radius: 10px; background: #fbeeec; color: #a3261f; font-weight: 700; font-size: 13px; cursor: pointer; }

.auth-shake { animation: authShake 360ms ease; }

.auth-modal-screen { background: rgba(18, 24, 22, 0.55); backdrop-filter: blur(3px); }

.auth-modal-screen .auth-card { box-shadow: 0 30px 70px rgba(0,0,0,0.3); }

/* Inaktivitäts-Abmeldefenster: „Erneut anmelden"-Button mittig (Button steht sonst links, da kein Formular-Grid). */
.auth-card-modal { text-align: center; }

.auth-card-modal .auth-submit { display: inline-block; padding: 0 28px; }

.auth-card-modal .auth-row .auth-submit { display: inline-flex; align-items: center; justify-content: center; padding: 0; }

.auth-card-modal .auth-relogin-submit { height: 38px; border-radius: 10px; font-size: 14px; }

/* Benutzer-Leiste in der Topbar: nur Avatar-Logo + Dropdown */
.userbar { position: relative; display: inline-flex; align-items: center; margin-left: 4px; }

.userbar-ava-btn { display: inline-flex; padding: 2px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; line-height: 0; }

.userbar-ava-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }

.userbar-ava { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent); transition: filter 140ms ease, transform 120ms ease; }

.userbar-ava-btn:hover .userbar-ava { filter: brightness(1.07); transform: translateY(-1px); }

.userbar-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 7px;
  box-shadow: 0 16px 38px rgba(20, 31, 28, 0.18); display: grid; gap: 2px;
  transform-origin: top right; animation: userMenuIn 150ms ease; }

.userbar-menu[hidden] { display: none; }

.userbar-menu-head { padding: 6px 10px 8px; margin-bottom: 2px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 800; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.userbar-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; }

.userbar-menu-item:hover { background: var(--accent-soft); color: var(--accent); }

.userbar-menu-note { padding: 6px 10px; font-size: 11.5px; line-height: 1.35; color: var(--muted, #8a8f98); }

.userbar-menu-item svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.userbar-menu-sec { padding: 8px 10px 3px; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }

.userbar-menu-divider { height: 1px; margin: 5px 4px; background: var(--line); }

.userbar-menu-item.is-active { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); color: var(--accent); }

.userbar-menu-item .uvi-ava { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center;
  border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); font-size: 11px; font-weight: 800; flex: none; stroke: none; }

.userbar-menu-item .uvi-check { margin-left: auto; width: 16px; height: 16px; color: var(--accent); }

.userbar-viewbadge { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; vertical-align: middle; text-transform: none; letter-spacing: 0; }

.userbar.is-viewing .userbar-ava { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-2); }

/* Adminbereich */
.auth-admin-screen { background: rgba(18, 24, 22, 0.5); backdrop-filter: blur(3px); align-items: flex-start; }

.admin-panel { position: relative; z-index: 1; width: min(760px, 100%); margin: 32px auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 70px rgba(0,0,0,0.28); overflow: hidden; opacity: 1; }

.admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line); }

.admin-head h1 { margin: 0 0 3px; font-size: 19px; }

.admin-head p { margin: 0; color: var(--muted); font-size: 13px; }

.admin-body { padding: 18px 22px 24px; display: grid; gap: 14px; max-height: calc(100vh - 160px); overflow: auto; }

.admin-loading { color: var(--muted); }

.admin-user { border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; display: grid; gap: 11px; background: color-mix(in srgb, var(--accent-soft) 22%, var(--surface)); }

.admin-user-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.admin-user-id { display: flex; align-items: center; gap: 10px; }

.admin-user-id strong { font-size: 15px; }

.admin-user-id small { display: block; color: var(--muted); font-size: 12px; }

.admin-user-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.admin-note { margin: 0; color: var(--muted); font-size: 12px; }

.admin-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px 12px; }

.admin-tab { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); }

.admin-tab input { width: 16px; height: 16px; accent-color: var(--accent); }

.admin-row-foot { display: flex; align-items: center; gap: 10px; }

.admin-saved { color: var(--accent); font-size: 12px; font-weight: 700; }

.admin-saved[hidden] { display: none; }

.admin-create { border-top: 1px dashed var(--line); padding-top: 16px; margin-top: 2px; }

.admin-create h2 { margin: 0 0 11px; font-size: 15px; }

.admin-create-form { display: grid; gap: 12px; }

.admin-create-top { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.admin-create-top label { display: grid; gap: 5px; }

.admin-create-top span { font-size: 12px; font-weight: 700; color: var(--muted); }

.admin-create-top input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 14px; }

@media (max-width: 560px) { .admin-create-top { grid-template-columns: 1fr; } .admin-user-head { align-items: flex-start; } }

/* „Passwort anzeigen"-Auge in Passwortfeldern (Login/Setup/Modals) */
.auth-pw-wrap { position: relative; display: block; }

.auth-pw-wrap input { width: 100%; padding-right: 44px; box-sizing: border-box; }

.auth-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}

.auth-pw-toggle:hover { color: var(--accent); background: var(--accent-soft); }

.auth-pw-toggle svg { width: 19px; height: 19px; }
/* Avatar-Slot in der Kopfzeile + Rolle im Dropdown (Management Dienstplan) */
[data-userbar-slot] {
  justify-self: end;
  display: flex;
  align-items: center;
}
.userbar-role {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

/* Vor der Anmeldung App-Inhalt verbergen (kein kurzes Aufblitzen des Dienstplans) */
body.auth-pending main,
body.auth-pending .topbar .tabs,
body.auth-pending [data-userbar-slot] {
  visibility: hidden;
}

@media (max-width: 1100px) {
  .report-calendar-table .report-calendar-name-col,
  .report-calendar-table tbody th,
  .report-calendar-table thead .report-calendar-name {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
  }

  .report-calendar-table .report-calendar-day-col,
  .report-calendar-table th,
  .report-calendar-table td,
  .report-calendar-table thead th {
    width: calc((100% - 200px) / 31);
  }
}

@media (max-width: 760px) {
  .report-card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .report-calendar-table .report-calendar-name-col,
  .report-calendar-table tbody th,
  .report-calendar-table thead .report-calendar-name {
    width: 176px;
    min-width: 176px;
    max-width: 176px;
  }

  .report-calendar-table .report-calendar-day-col,
  .report-calendar-table th,
  .report-calendar-table td,
  .report-calendar-table thead th {
    width: calc((100% - 176px) / 31);
    min-width: 24px;
  }

  .report-name-cell .emp-cell-avatar {
    flex-basis: 20px;
    width: 20px;
    min-width: 20px;
    max-width: 20px;
    height: 20px;
    min-height: 20px;
  }

  .apl-grid {
    grid-template-columns: 1fr 1fr;
  }

  .apl-head {
    flex-direction: column;
  }
}
