:root {
  --color-primary: #6b3f2a;
  --color-primary-dark: #4a2b1c;
  --color-accent: #c98a3e;
  --color-bg: #faf7f2;
  --color-bg-alt: #ffffff;
  --color-text: #2b2118;
  --color-border: #e4dccf;
  --color-success: #3a7d44;
  --color-danger: #b3452c;
  --color-warning: #c98a3e;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

a { color: var(--color-primary); }

.topbar {
  background: var(--color-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-top {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.mainnav-bar { background: var(--color-primary-dark); }
.mainnav-bar .mainnav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.45rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
}
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; display: flex; align-items: center; gap: 0.7rem; }
.brand-logo { height: 76px; width: auto; max-width: 76px; max-height: 76px; display: block; background: #fff; border-radius: 6px; padding: 3px; object-fit: contain; }
.brand-text { line-height: 1.15; }
.mainnav a { color: #f3e6d8; text-decoration: none; font-size: 0.92rem; }
.mainnav a:hover { color: #fff; text-decoration: underline; }
.user-area { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.user-area a { color: #f3e6d8; }

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.15rem; }

.login-box {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--color-bg-alt);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.formular, .login-box form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 480px;
}
.formular label, .login-box label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }

input[type=text], input[type=password], input[type=email], input[type=date], input[type=time], select, textarea {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
textarea { resize: vertical; }

button, .button-primary, .button-secondary, .button-danger, .button-klein {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
button[type=submit], .button-primary {
  background: var(--color-primary);
  color: #fff;
}
button[type=submit]:hover, .button-primary:hover { background: var(--color-primary-dark); }
.button-secondary {
  background: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.button-danger { background: var(--color-danger); color: #fff; }
.button-klein { padding: 0.3rem 0.6rem; font-size: 0.85rem; background: var(--color-accent); color: #fff; }
.link-button { background: none; border: none; color: var(--color-danger); text-decoration: underline; cursor: pointer; padding: 0; font-weight: 600; font-size: 0.9rem; }
.inline-form { display: inline; }

.fehler { color: var(--color-danger); font-weight: 600; }
.erfolg { color: var(--color-success); font-weight: 600; }
.hinweis { color: #6b5c4a; font-style: italic; }
.hinweis-box { background: #fbe9d0; border: 1px solid var(--color-accent); padding: 0.6rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }

.ansicht-umschalter { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.ansicht-umschalter a {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-primary);
}
.ansicht-umschalter a.aktiv { background: var(--color-primary); color: #fff; }

.zeitraum-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-block {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.tag-block h2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; font-size: 1.05rem; gap: 0.5rem; flex-wrap: wrap; }

.leer { color: #8a7a64; font-style: italic; margin: 0; }

table.schicht-tabelle, table.daten-tabelle {
  width: 100%;
  border-collapse: collapse;
}
table.schicht-tabelle th, table.schicht-tabelle td,
table.daten-tabelle th, table.daten-tabelle td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: 0.92rem;
}
table.schicht-tabelle thead, table.daten-tabelle thead {
  background: #f1e9dd;
}

tr.eigene-schicht { background: #fdf3e3; font-weight: 600; }
tr.abwesend { opacity: 0.7; }
.badge-abwesend {
  background: var(--color-danger);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.3rem;
}
tr.bereich-kueche td:first-child { border-left: 3px solid #b3452c; }
tr.bereich-service td:first-child { border-left: 3px solid #3a7d44; }

.status { padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.8rem; font-weight: 700; color: #fff; }
.status-offen { background: var(--color-warning); }
.status-angenommen { background: var(--color-success); }
.status-abgelehnt { background: var(--color-danger); }

.bedingtes-feld { display: none; border-left: 3px solid var(--color-accent); padding-left: 0.8rem; }

.site-footer { text-align: center; padding: 1.5rem; color: #8a7a64; font-size: 0.85rem; line-height: 1.5; }

/* Mobile: Tabellen als Karten darstellen */
@media (max-width: 640px) {
  table.schicht-tabelle thead, table.daten-tabelle thead { display: none; }
  table.schicht-tabelle tr, table.daten-tabelle tr {
    display: block;
    margin-bottom: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
  }
  table.schicht-tabelle td, table.daten-tabelle td {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px dashed var(--color-border);
    padding: 0.35rem 0;
  }
  table.schicht-tabelle td:last-child, table.daten-tabelle td:last-child { border-bottom: none; }
  table.schicht-tabelle td::before, table.daten-tabelle td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #6b5c4a;
    margin-right: 0.5rem;
  }
}

@media print {
  .topbar, .site-footer, .no-print { display: none; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; color-adjust: exact !important; }
}

/* Anwesenheiten (Zeitgitter) */
.legende-punkt {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.2rem;
  vertical-align: middle;
}
.legende-kueche { background: #b3452c; }
.legende-service { background: #3a7d44; }
.legende-abwesend { background: #cfc6b8; }

.anwesenheit-tag {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.anwesenheit-tabelle {
  border-collapse: collapse;
  min-width: 100%;
}
.anwesenheit-tabelle th, .anwesenheit-tabelle td {
  border: 1px solid var(--color-border);
  text-align: center;
  padding: 0;
  height: 1.8rem;
}
.anwesenheit-tabelle thead th {
  background: #f1e9dd;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b5c4a;
  padding: 0.3rem 0.2rem;
  height: auto;
}
.name-kopf, .name-zelle {
  text-align: left !important;
  padding: 0.3rem 0.6rem !important;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.85rem;
  background: #fff;
  position: sticky;
  left: 0;
}
.bemerkung-kopf, .bemerkung-zelle {
  text-align: left !important;
  padding: 0.3rem 0.6rem !important;
  white-space: nowrap;
  font-size: 0.78rem;
  color: #6b5c4a;
  background: #fff;
}
.zeit-zelle { width: 2.1rem; min-width: 2.1rem; background: #fbf9f5; }
.zeit-zelle.belegt.bereich-kueche { background: #b3452c; }
.zeit-zelle.belegt.bereich-service { background: #3a7d44; }
.zeit-zelle.abwesend-zelle { background: #e5e0d5; }
tr.zeile-abwesend .name-zelle,
tr.zeile-abwesend .bemerkung-zelle { color: #8a7a64; font-style: italic; }
.gantt-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .brand-logo { height: 44px !important; max-width: 44px !important; max-height: 44px !important; }
  .brand-text { font-size: 0.95rem; }
  .zeit-zelle { width: 1.6rem; min-width: 1.6rem; }
  .name-zelle { font-size: 0.78rem; padding: 0.25rem 0.4rem !important; }
  .bemerkung-zelle { font-size: 0.7rem; white-space: normal; }
}

/* Einstellungsseite */
.ruhetage-auswahl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-top: 0.4rem;
}
.ruhetage-auswahl .checkbox-label { font-weight: 400; }
.formular-kompakt {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin: 0.75rem 0 1.75rem;
  max-width: none;
}
.formular-kompakt label { min-width: 150px; }
input[type=color] {
  width: 3rem;
  height: 2.2rem;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}

/* Monatsuebersicht */
.legende-flaeche {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 2px;
  margin-right: 0.15rem;
  vertical-align: middle;
  border: 1px solid var(--color-border);
}
.kalender-wochentage {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #6b5c4a;
}
.kalender-gitter {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}
.kalender-tag {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.35rem;
  min-height: 5.5rem;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
}
.kalender-tag.anderer-monat { opacity: 0.4; }
.kalender-tag-nummer {
  font-weight: 700;
  font-size: 0.85rem;
  color: inherit;
  text-decoration: none;
}
.kalender-tag-nummer:hover { text-decoration: underline; }
.kalender-tag-label { font-size: 0.68rem; font-weight: 600; }
.kalender-tag-info { font-size: 0.68rem; }
.kalender-tag-event {
  font-size: 0.68rem;
  background: rgba(255,255,255,0.6);
  border-radius: 3px;
  padding: 0 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .kalender-tag { min-height: 4rem; font-size: 0.68rem; padding: 0.25rem; }
  .kalender-tag-nummer { font-size: 0.75rem; }
  .kalender-gitter, .kalender-wochentage { gap: 0.25rem; }
}

/* Status-Label und Events im Dienstplan / Anwesenheiten */
.tag-status-label {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255,255,255,0.55);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
}
.tag-event {
  font-size: 0.8rem;
  background: rgba(255,255,255,0.55);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  margin-top: 0.3rem;
  display: inline-block;
}

/* Druckansicht */
.druck-kopf {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
}
.druck-kopf img { height: 60px; width: auto; }
.druck-kopf h1 { margin: 0; font-size: 1.4rem; }
.druck-kopf p { margin: 0.15rem 0 0; color: #6b5c4a; font-size: 0.9rem; }
.druck-tag {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.9rem;
  overflow: hidden;
  page-break-inside: avoid;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.druck-tag-kopf {
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}
.druck-tag-inhalt { padding: 0.6rem 0.8rem; }
.druck-abschnitt-titel { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: #6b5c4a; margin: 0.5rem 0 0.2rem; }
.druck-abwesend-liste, .druck-event-liste { font-size: 0.85rem; margin: 0; padding-left: 1.1rem; }
