:root {
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --line: #dcdad3;
  --line-strong: #b9b6ad;
  --ink: #1b1b19;
  --muted: #6b6a63;
  --accent: #8a3324;
  --accent-soft: #f7ece9;
  --ok: #2f6b3f;
  --ok-soft: #eaf2ec;
  --warn: #9a5b10;
  --warn-soft: #fbf1e2;
  --radius: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

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

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- Kopfzeile ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: baseline;
  justify-content: space-between;
}

.topbar h1 { font-size: 21px; }

.topbar .sub { color: var(--muted); font-size: 14px; }

.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Bedienelemente ---------- */

button, .btn {
  font: inherit;
  font-size: 14px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button:hover, .btn:hover { background: var(--surface-2); }

button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover { background: #74291d; }

button.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 6px 8px; }
button.ghost:hover { background: #ebe9e3; color: var(--ink); }

button.danger { color: var(--accent); }

button[disabled] { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font: inherit;
  font-size: 15px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}

textarea { resize: vertical; min-height: 62px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.field { margin-bottom: 12px; }

/* ---------- Filterleiste ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 20px 0 4px;
}

.toolbar .search { flex: 1 1 240px; max-width: 320px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 13px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Tag ---------- */

.day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 18px;
  overflow: hidden;
}

.day-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.day-head h2 { font-size: 16px; }
.day-head .meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.group-head {
  padding: 10px 16px 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Schichtzeilen ---------- */

.shift {
  display: grid;
  grid-template-columns: 118px 168px 1fr auto;
  gap: 4px 16px;
  align-items: start;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
}

.day > .shift:first-of-type,
.group-head + .shift { border-top: none; }

.shift .time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.shift .place { color: var(--ink); }

.shift .people { color: var(--ink); }
.shift .people .empty { color: var(--warn); }

.shift .note { grid-column: 2 / -1; font-size: 13px; color: var(--muted); }

.person { white-space: nowrap; }
.person mark { background: #ffe9a8; padding: 0 1px; }

.count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
}
.count.full { color: var(--ok); background: var(--ok-soft); border-color: #c7dccd; }
.count.open { color: var(--warn); background: var(--warn-soft); border-color: #e8d4b2; }

.slots { display: inline-flex; gap: 3px; margin-left: 7px; vertical-align: -1px; }
.slot { width: 6px; height: 12px; border-radius: 1px; background: var(--ok); opacity: 0.75; }
.slot.free { background: transparent; border: 1px solid var(--line-strong); }

.mine { background: #fffdf3; }

/* ---------- Hinweise ---------- */

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  margin-top: 18px;
}

.note-box {
  margin-top: 24px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.msg { padding: 9px 12px; border-radius: var(--radius); font-size: 14px; margin-bottom: 12px; }
.msg.error { background: var(--accent-soft); color: #74291d; border: 1px solid #e3c7c1; }
.msg.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #c7dccd; }

.foot { margin-top: 28px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- Mobil ---------- */

@media (max-width: 720px) {
  .shift {
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    padding: 12px 14px;
  }
  .shift .time { grid-column: 1; }
  .shift .count { grid-column: 2; grid-row: 1; }
  .shift .place { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
  .shift .people { grid-column: 1 / -1; }
  .shift .note { grid-column: 1 / -1; }
}

/* ---------- Druck ---------- */

@media print {
  body { background: #fff; font-size: 11pt; }
  .toolbar, .topbar-actions, .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .day { border-color: #999; break-inside: avoid; page-break-inside: avoid; margin-top: 12px; }
  .day-head { background: #eee; }
  .count { border-color: #999; }
}
