:root {
  --color-bg: #f6f3ee;
  --color-surface: #ffffff;
  --color-primary: #1a3d2e;
  --color-accent: #c9a227;
  --color-text: #1f1f1f;
  --color-muted: #6b6b6b;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

a { color: var(--color-primary); }

.site-header {
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-header a { color: #fff; text-decoration: none; }

.header-user { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.header-link { font-size: 0.9rem; opacity: 0.95; }

.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 0.25rem; }

.brand { font-weight: 700; letter-spacing: 0.04em; }

.site-logo { display: inline-flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.site-logo-img { display: block; height: auto; max-width: 100%; object-fit: contain; }
.site-logo-img--header { max-height: 2.75rem; }
.site-logo-img--login { max-height: 7rem; margin: 0 auto; }
.site-logo-img--print { max-height: 5rem; margin: 0 auto 0.75rem; }
.site-logo-img--footer { max-height: 2rem; opacity: 0.9; }
.site-logo-img--inverted { filter: brightness(0) invert(1); }

.login-brand { text-align: center; margin-bottom: 0.5rem; }

.site-footer {
  padding-bottom: 2rem;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.error-brand { text-align: center; margin: 1.5rem 0; }

.nav a {
  margin-right: 1rem;
  opacity: 0.9;
}

.nav a:hover { opacity: 1; text-decoration: underline; }

.container {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.container-wide { max-width: 1100px; }
.container-dienstplan { max-width: 1320px; }

.dienstplan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 1rem;
  align-items: start;
}

.dienstplan-main { min-width: 0; }
.dienstplan-reservations h2 { margin-top: 0; }

.week-reservations {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.week-res-day {
  background: #fafafa;
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  border: 1px solid #eee;
}

.week-res-day-focus {
  background: #f0f7f4;
  border-color: #1a3d2e33;
}

.week-res-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid #ddd;
}

.week-res-day-head a { text-decoration: none; }
.week-res-day-head a:hover { text-decoration: underline; }

.week-res-count {
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  line-height: 1.4;
}

.week-res-empty { color: var(--color-muted); font-size: 0.8rem; margin: 0; }
.week-res-list { margin: 0; padding-left: 0.9rem; font-size: 0.78rem; line-height: 1.35; }
.week-res-list li { margin-bottom: 0.25rem; }
.week-res-list .badge { margin-right: 0.15rem; }

@media (max-width: 960px) {
  .dienstplan-layout { grid-template-columns: 1fr; }
  .week-reservations { max-height: none; }
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card h2 { margin-top: 0; font-size: 1.1rem; }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.btn {
  display: inline-block;
  background: var(--color-primary);
  color: #fff !important;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 1rem;
}

.btn:hover { filter: brightness(1.1); }

.form-group { margin-bottom: 1rem; }

.form-group label { display: block; margin-bottom: 0.35rem; font-weight: 600; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 360px;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.form-group textarea {
  max-width: 100%;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.form-row .form-group { flex: 1 1 140px; }

.btn-secondary { background: #5a6b63; }
.btn-small { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-danger { background: #8b2e2e; }

.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  background: #eee;
}

.badge-beantragt { background: #fff3e0; color: #e65100; }
.badge-genehmigt { background: #e8f5e9; color: #2e7d32; }
.badge-abgelehnt { background: #fde8e8; color: #c62828; }

.shift-weekend { background: #f0f7f4; }
.shift-mine { background: #fff8e1; }

.hint { color: var(--color-muted); font-size: 0.9rem; }
.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary, #1a3d2e);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}
.btn-link:hover { filter: brightness(1.2); }

.approval-list { list-style: none; padding: 0; }
.approval-list li { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid #eee; }

.qr-card { text-align: center; }
.qr-card img { border-radius: 8px; margin: 0.5rem 0; }

.diagnose-log {
  background: #1a1a1a;
  color: #e8e8e8;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.week-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.week-day {
  background: #fafafa;
  border-radius: 8px;
  padding: 0.5rem;
  min-height: 100px;
  border: 1px solid #eee;
}

.week-day-focus {
  background: #f0f7f4;
  border-color: #1a3d2e33;
}

.week-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #ddd;
}

.week-day-copy { margin: 0; }
.week-day-copy .btn { padding: 0.1rem 0.4rem; line-height: 1.2; }

.shift-day-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.form-group-wide { flex: 1 1 100%; }

.week-day-empty { color: var(--color-muted); font-size: 0.85rem; margin: 0; }

.week-shift {
  background: #fff;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.week-shift-del { margin-top: 0.25rem; }
.week-shift-del .btn { padding: 0.1rem 0.4rem; }

.nav-badge {
  background: var(--color-accent);
  color: #1a1f1a;
  border-radius: 10px;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
}

@media (max-width: 800px) {
  .week-calendar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .week-calendar { grid-template-columns: 1fr; }
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert-error { background: #fde8e8; color: #8b1a1a; }
.alert-success { background: #e8f5e9; color: #1b5e20; }
.alert-info { background: #e3f2fd; color: #0d47a1; }

.login-wrap {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card { width: 100%; max-width: 400px; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
}

.shift-mine { background: #fff8e1; }

.checklist label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  cursor: pointer;
}

.checklist input:checked + span { text-decoration: line-through; color: var(--color-muted); }

.checklist-row {
  border-bottom: 1px solid #eee;
  padding: 0.5rem 0;
}

.checklist-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

.item-edit { margin-top: 0.35rem; font-size: 0.9rem; }
.item-edit summary { cursor: pointer; color: var(--color-primary); }

.history-list { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.9rem; }

.cleaning-scroll { overflow-x: auto; }

.cleaning-grid {
  font-size: 0.75rem;
  min-width: 800px;
  width: 100%;
  border-collapse: collapse;
}

.cleaning-grid th,
.cleaning-grid td {
  padding: 0.25rem;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #c8c8c8;
}

.cleaning-grid thead th { background: #f5f5f5; }

.cleaning-day-col {
  font-weight: 700;
  background: #f5f5f5;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 2px solid #a8a8a8;
}

.cleaning-cell {
  min-width: 3.5rem;
  min-height: 2.5rem;
  cursor: pointer;
  background: #fff;
  user-select: none;
}

.cleaning-cell:hover { background: #f0f7f4; }
.cleaning-done { background: #e8f5e9; }
.cleaning-cross { background: #fde8e8; color: #c62828; }

.cleaning-mark { font-weight: 700; display: block; }
.cleaning-initials { font-weight: 700; font-size: 0.7rem; }
.cleaning-time { display: block; font-size: 0.65rem; color: var(--color-muted); }

.reservation-shift-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }

.reservation-day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.reservation-week { font-size: 0.9rem; color: var(--color-muted); }
.reservation-date-title { font-size: 1.35rem; font-weight: 700; font-family: Georgia, serif; }
.reservation-shift-label { font-weight: 600; color: var(--color-primary); }

.reservation-slots {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.reservation-slot {
  text-align: center;
  min-width: 3.5rem;
}

.reservation-slot-time { display: block; font-size: 0.75rem; color: var(--color-muted); }

.reservation-slot-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0.25rem auto 0;
  border: 2px solid #333;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.reservation-slot-occupied .reservation-slot-box {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.reservation-slot-warning .reservation-slot-box {
  background: #fff3cd;
  border-color: #e6a800;
  color: #856404;
}

.reservation-slot-full .reservation-slot-box {
  background: #f8d7da;
  border-color: #c62828;
  color: #c62828;
}

.reservation-legend-warning { color: #856404; font-weight: 600; }
.reservation-legend-full { color: #c62828; font-weight: 600; }
.reservation-special-heading { margin: 0 0 0.75rem; font-size: 1.05rem; }

.reservation-total-row td {
  background: #f0f0f0;
  border-top: 2px solid #4a4a4a;
  text-align: right;
}

.reservation-total-row td:nth-child(1) { text-align: right; }
.reservation-total-row td:nth-child(2) { text-align: center; font-size: 1rem; }

.reservation-scroll { overflow-x: auto; }

.reservation-table { font-size: 0.9rem; min-width: 700px; }
.reservation-table thead th { background: #4a4a4a; color: #fff; border: none; }
.reservation-table td, .reservation-table th { border: 1px solid #ddd; }

.reservation-checked { opacity: 0.65; }
.reservation-checked td:not(.reservation-check-col) { text-decoration: line-through; color: var(--color-muted); }
.reservation-checked .reservation-check-col { text-decoration: none; }

.reservation-row-event { background: #fff8e1; }
.reservation-row-closed { background: #fde8e8; }
.reservation-row-schnitzel { background: #fff8e6; }
.reservation-row-buffet { background: #f3e5f5; }
.reservation-row-besprechung { background: #e3f2fd; }

.reservation-check-label { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; cursor: pointer; }
.reservation-check-meta { font-size: 0.7rem; color: var(--color-muted); }

.badge-res-event { background: #fff3e0; color: #e65100; }
.badge-res-closed { background: #fde8e8; color: #c62828; }
.badge-res-schnitzel { background: #fff8e1; color: #f57f17; }
.badge-res-holiday { background: #e8f5e9; color: #2e7d32; }
.badge-res-buffet { background: #f3e5f5; color: #6a1b9a; }
.badge-res-besprechung { background: #e3f2fd; color: #1565c0; }
.badge-recurrence { background: #e8f4fd; color: #1565c0; font-size: 0.75rem; padding: 0.1rem 0.35rem; }
.badge-shift-mittag { background: #e3f2fd; color: #1565c0; font-size: 0.75rem; }
.badge-shift-abend { background: #ede7f6; color: #4527a0; font-size: 0.75rem; }

.card-nested {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg);
  border-radius: var(--radius);
}

.reservation-recurrence-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-label input { width: auto; margin: 0; }

.reservation-month-table td { vertical-align: top; }
.reservation-day-label { font-weight: 600; white-space: nowrap; width: 6rem; }
.reservation-sunday .reservation-day-label a { color: #c62828; }
.reservation-holiday .reservation-day-label a { color: #2e7d32; }
.reservation-thursday .reservation-day-label { font-weight: 600; }
.reservation-day-header .badge-res-schnitzel { margin-left: 0.5rem; vertical-align: middle; font-size: 0.8rem; }
.reservation-month-list { margin: 0; padding-left: 1rem; font-size: 0.9rem; }
.reservation-month-list li { margin-bottom: 0.2rem; }

@media (max-width: 600px) {
  .nav { width: 100%; }
  .nav a { display: inline-block; margin: 0.25rem 0.75rem 0.25rem 0; }
}

/* Buffet-Generator */
.buffet-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.buffet-field-full { grid-column: 1 / -1; }

.buffet-form .form-group input,
.buffet-form .form-group select,
.buffet-form .form-group textarea {
  max-width: none;
  width: 100%;
}

.buffet-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.buffet-section-head h2 { margin: 0; }

.buffet-tip { margin: 0.35rem 0 0; max-width: 42rem; }

.chafing-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chafing-card {
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  background: #fafafa;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.chafing-card.chafing-dragging { opacity: 0.55; }
.chafing-card.chafing-drag-over { box-shadow: 0 0 0 2px var(--color-primary); }

.chafing-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  border-radius: var(--radius) var(--radius) 0 0;
}

.chafing-drag-handle {
  cursor: grab;
  color: var(--color-muted);
  font-size: 1.1rem;
  user-select: none;
  touch-action: none;
}

.chafing-card-title { flex: 1; }

.chafing-card-actions {
  display: flex;
  gap: 0.25rem;
}

.chafing-card-body { padding: 1rem; }

.gn-section {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--color-surface);
  border-radius: 8px;
  border: 1px solid #eee;
}

.gn-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.gn-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.gn-list { display: flex; flex-direction: column; gap: 0.75rem; }

.gn-row {
  display: grid;
  grid-template-columns: minmax(5rem, 0.7fr) minmax(4.5rem, 0.6fr) minmax(8rem, 1.4fr) minmax(5rem, 0.8fr) minmax(6rem, 1fr) auto;
  gap: 0.5rem;
  align-items: end;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.gn-row:last-child { border-bottom: none; padding-bottom: 0; }

.gn-row .form-group { margin-bottom: 0; }
.gn-row label { font-size: 0.8rem; font-weight: 600; }

.btn-icon {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.2;
}

.btn-icon:hover:not(:disabled) { background: #f5f5f5; }
.btn-icon:disabled { opacity: 0.35; cursor: default; }

.btn-danger-icon {
  border-color: #e0b4b4;
  color: #8b2e2e;
  align-self: end;
  margin-bottom: 0.1rem;
}

.buffet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 2rem;
}

.required { color: #c62828; }

.print-buffet-chafing { margin-bottom: 1.5rem; }
.print-buffet-section { margin-bottom: 1.5rem; }
.print-section-title { margin: 1.25rem 0 0.75rem; font-size: 1.15rem; }
.print-buffet-temp { font-weight: 400; font-size: 0.95rem; color: var(--color-muted); }

.section-list { display: flex; flex-direction: column; gap: 0.75rem; }

.section-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.4fr) minmax(6rem, 0.9fr) minmax(8rem, 1.1fr) auto;
  gap: 0.5rem;
  align-items: end;
  padding: 0.75rem;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
}

.section-row .form-group { margin-bottom: 0; }
.section-row label { font-size: 0.8rem; font-weight: 600; }

.section-row-actions {
  display: flex;
  gap: 0.2rem;
  align-self: end;
  margin-bottom: 0.1rem;
}

.section-list[data-section="dessert"] .section-row {
  grid-template-columns: minmax(7rem, 0.9fr) minmax(9rem, 1.2fr) minmax(5rem, 0.8fr) minmax(7rem, 1fr) auto;
}

.buffet-scroll { overflow-x: auto; }

.buffet-product-table { min-width: 640px; }
.buffet-product-table td { vertical-align: middle; }
.buffet-product-inactive { opacity: 0.55; }

.buffet-inline-input {
  width: 100%;
  max-width: none;
  padding: 0.4rem 0.55rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font: inherit;
}

.buffet-inline-narrow { max-width: 5rem; }

@media (max-width: 900px) {
  .buffet-form-grid { grid-template-columns: 1fr; }
  .gn-row {
    grid-template-columns: 1fr 1fr;
  }
  .gn-field-product,
  .gn-field-note,
  .gn-row .btn-danger-icon {
    grid-column: 1 / -1;
  }
  .section-row,
  .section-list[data-section="dessert"] .section-row {
    grid-template-columns: 1fr 1fr;
  }
  .section-field-product,
  .section-field-note,
  .section-field-label,
  .section-row-actions {
    grid-column: 1 / -1;
  }
}
