/*
 * Personal-Modul: Liste + Edit-Modal.
 * Greift auf die Tokens + Base-Styles zurück.
 */

.status-bar {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
}
.status-bar.ok    { background: var(--color-status-ok-soft); color: var(--color-status-ok); border: 1px solid var(--color-status-ok); }
.status-bar.error { background: var(--color-status-error-soft); color: var(--color-status-error); border: 1px solid var(--color-status-error); }
.status-bar.info  { background: var(--color-status-info-soft); color: var(--color-status-info); border: 1px solid var(--color-status-info); }

.filter-bar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
}

.filter-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
}

.filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-md);
}

.section-title {
  margin: var(--space-4) 0 var(--space-3);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}
.section-title span { margin-left: var(--space-2); font-weight: var(--font-weight-regular); }

.data-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-loading,
.data-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
}

.emp-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 140px 1fr 80px;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.emp-row:hover { background: var(--color-surface-alt); }
.emp-row:last-child { border-bottom: none; }
.emp-row.is-inactive { opacity: 0.7; }

.emp-row-actions { display: flex; justify-content: flex-end; }
.emp-row-edit-btn {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.emp-row-edit-btn:hover {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
  background: var(--color-surface);
}

.emp-name { font-weight: var(--font-weight-semibold); }
.emp-sub { font-size: var(--font-size-xs); color: var(--color-text-muted); margin-top: 2px; }

.emp-gruppe {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  background: var(--color-surface-muted);
}
.emp-gruppe[data-gruppe="fahrpersonal"] { background: var(--color-status-info-soft); color: var(--color-status-info); }
.emp-gruppe[data-gruppe="werkstatt"]    { background: var(--color-status-warn-soft); color: var(--color-status-warn); }
.emp-gruppe[data-gruppe="buero"]        { background: var(--color-status-ok-soft); color: var(--color-status-ok); }
.emp-gruppe[data-gruppe="inhaber"]      { background: var(--color-brand-primary-soft); color: var(--color-brand-primary); }

.emp-contact { font-size: var(--font-size-sm); color: var(--color-text-muted); }
.emp-meta { text-align: right; font-size: var(--font-size-xs); color: var(--color-text-subtle); }

@media (max-width: 800px) {
  .emp-row { grid-template-columns: 1fr; }
  .emp-meta { text-align: left; }
}

/* === Archiv === */
.archive-box {
  margin-top: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
}
.archive-box[open] { background: var(--color-surface); }

.archive-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  user-select: none;
  list-style: none;
}
.archive-summary::-webkit-details-marker { display: none; }
.archive-summary::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}
.archive-box[open] .archive-summary::before { transform: rotate(90deg); }

.archive-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 8px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
}

.archive-box .data-list {
  border-top: 1px solid var(--color-border);
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

/* === Edit-Dialog === */
.edit-dialog {
  width: 100%;
  max-width: 720px;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  background: var(--color-surface);
}

.edit-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }

.edit-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}
.edit-dialog-header h2 { margin: 0; font-size: var(--font-size-xl); }

.edit-dialog-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}
.footer-spacer { flex: 1; }

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  padding: var(--space-6);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field > span {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-md);
  font-family: var(--font-family-base);
}

.field textarea {
  resize: vertical;
  min-height: 76px;
}

.field-wide { grid-column: 1 / -1; }
.field-sm { max-width: 140px; }

/* Kalender-Modal: groß damit der ganze Kalender reinpasst */
.calendar-dialog { width: 95vw; max-width: 1280px; max-height: 90vh; }
.calendar-mount { padding: var(--space-4); min-height: 540px; }

/* === Arbeitszeit-Tabelle === */
.schedule-section-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  margin: var(--space-4) var(--space-6) var(--space-3);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--color-border);
}

.schedule-table {
  width: calc(100% - 2 * var(--space-6));
  margin: 0 var(--space-6) var(--space-6);
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.schedule-table thead th {
  text-align: left;
  padding: 8px 6px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
}

.schedule-table tbody tr {
  border-bottom: 1px solid var(--color-border);
}

.schedule-table td {
  padding: 6px;
  vertical-align: middle;
}

.schedule-table td input[type="text"],
.schedule-table td input[type="time"],
.schedule-table td input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  text-align: center;
}
.schedule-table td input:disabled,
.schedule-table tr.is-off input { opacity: 0.4; background: var(--color-surface-muted); }
.schedule-table tr.is-off { opacity: 0.7; }
.schedule-table td input[readonly] {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  cursor: default;
  border-color: transparent;
}
.schedule-table td input[readonly]:focus { outline: none; box-shadow: none; }

.schedule-table .schedule-day { font-weight: var(--font-weight-medium); width: 110px; }
.schedule-table .schedule-toggle-cell { width: 100px; }

.schedule-table tfoot td {
  padding: 12px 6px;
  border-top: 2px solid var(--color-border-strong);
  font-size: var(--font-size-sm);
}

.schedule-table .schedule-total { font-family: var(--font-family-mono); font-size: var(--font-size-md); text-align: center; }
.schedule-table tfoot td.muted { text-align: right; }

/* Schmaler Toggle-Switch (ähnlich wie in der Nutzerverwaltung) */
.s-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.s-toggle input { width: 0; height: 0; opacity: 0; position: absolute; }
.s-toggle input + .s-toggle-label {
  position: relative;
  padding-left: 40px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
}
.s-toggle input + .s-toggle-label::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 18px;
  background: var(--color-border-strong);
  border-radius: 999px;
  transition: background 120ms ease;
}
.s-toggle input + .s-toggle-label::after {
  content: "";
  position: absolute;
  left: 2px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: left 120ms ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.s-toggle input:checked + .s-toggle-label::before { background: var(--color-brand-primary); }
.s-toggle input:checked + .s-toggle-label::after { left: 16px; }
.s-toggle input:checked + .s-toggle-label { color: var(--color-brand-primary); }

@media (max-width: 640px) {
  .edit-grid { grid-template-columns: 1fr; }
  .field-sm { max-width: none; }
}
