/* ===================== ÖWR Design ===================== */
:root {
  --blue-900: #0a3352;
  --blue-700: #0e5a8a;
  --blue-500: #1d7fb8;
  --blue-100: #e3eff7;
  --red: #e63946;
  --red-100: #fdeaec;
  --green: #2a9d54;
  --green-100: #e6f5ec;
  --amber: #d99000;
  --amber-100: #fdf3dd;
  --bg: #f2f6f9;
  --card: #ffffff;
  --text: #1c2b36;
  --muted: #64798a;
  --border: #dde7ee;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(10, 51, 82, 0.08), 0 4px 16px rgba(10, 51, 82, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.85em; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; cursor: pointer; border: none;
  border-radius: 10px; padding: 9px 16px; font-weight: 600;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-500); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c92c3a; }
.btn-ghost { background: transparent; color: var(--blue-700); }
.btn-ghost:hover { background: var(--blue-100); }
.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-outline {
  background: #fff; color: var(--blue-700);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--blue-500); background: var(--blue-100); }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--blue-900) 0%, var(--blue-700) 60%, var(--blue-500) 100%);
  padding: 20px;
}
.auth-card {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  padding: 36px 32px; width: 100%; max-width: 400px; text-align: center;
}
.auth-logo img { width: 110px; height: 110px; }
.auth-card h1 { margin: 8px 0 2px; color: var(--blue-900); font-size: 26px; }
.auth-sub { margin: 0 0 22px; color: var(--muted); }
.auth-tabs {
  display: flex; background: var(--blue-100); border-radius: 10px;
  padding: 4px; margin-bottom: 20px;
}
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 8px;
  border-radius: 8px; font: inherit; font-weight: 600; color: var(--blue-700);
  cursor: pointer;
}
.auth-tab.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.auth-card form { text-align: left; }
.auth-card label, .profile-card label, .modal label {
  display: block; font-weight: 600; font-size: 13.5px; margin: 12px 0 4px;
  color: var(--blue-900);
}
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 10px; font: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(29, 127, 184, 0.15);
}
.error-msg {
  background: var(--red-100); color: var(--red); border-radius: 10px;
  padding: 10px 14px; margin: 14px 0 0; font-size: 14px; font-weight: 600;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--blue-900); color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; position: sticky; top: 0; z-index: 50;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.brand-icon { width: 36px; height: 36px; background: #fff; border-radius: 50%; }
.topbar-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-btn {
  display: flex; align-items: center; gap: 7px;
  background: transparent; border: none; color: rgba(255,255,255,0.75);
  font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 10px; cursor: pointer;
}
.nav-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-btn.active { background: rgba(255,255,255,0.16); color: #fff; }
.topbar .btn-ghost { color: rgba(255,255,255,0.85); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,0.12); }

main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 4px;
}
.page-head h2 { margin: 0; color: var(--blue-900); font-size: 24px; }
.page-info { color: var(--muted); font-size: 14px; margin-top: 4px; }
.head-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.year-nav { display: flex; align-items: center; gap: 4px; }
.year-nav .btn { font-size: 20px; padding: 4px 14px; }
.year-display { font-weight: 700; font-size: 18px; color: var(--blue-900); min-width: 130px; text-align: center; }

/* ---------- Dienstplan ---------- */
.weekend-group { margin-bottom: 26px; }
.weekend-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; margin: 0 0 10px 4px;
}
.weekend-days { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.day-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; border-top: 4px solid var(--border);
}
.day-card.past { opacity: 0.5; filter: grayscale(0.6); transition: opacity 0.15s, filter 0.15s; }
.day-card.past:hover { opacity: 1; filter: none; }
.day-card.complete { border-top-color: var(--green); }
.day-card.partial { border-top-color: var(--amber); }
.day-card.empty { border-top-color: var(--red); }
.day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.day-date { font-weight: 700; font-size: 17px; color: var(--blue-900); }
.day-head-right { display: flex; align-items: center; gap: 8px; }
.day-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.add-person-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--border);
  background: #fff; color: var(--blue-700); font-size: 17px; font-weight: 700;
  cursor: pointer; line-height: 1; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}
.add-person-btn:hover { background: var(--blue-100); border-color: var(--blue-500); }
.badge {
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  white-space: nowrap;
}
.badge.ok { background: var(--green-100); color: var(--green); }
.badge.warn { background: var(--amber-100); color: var(--amber); }
.badge.miss { background: var(--red-100); color: var(--red); }

.role-section { margin-top: 10px; }
.role-label {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
  display: flex; justify-content: space-between; align-items: center;
}
.entry {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 10px; padding: 7px 10px; margin-bottom: 5px;
}
.entry.auto { background: var(--green-100); }
.entry-name { font-weight: 600; }
.entry-note { color: var(--muted); font-size: 12.5px; }
.entry-quals { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.qual-chip {
  font-size: 10.5px; font-weight: 700; background: var(--blue-100);
  color: var(--blue-700); padding: 2px 7px; border-radius: 99px;
}
.qual-chip.sfg { background: #e8e3f7; color: #5b3fa8; }
.entry-del {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 15px; padding: 2px 4px; border-radius: 6px; line-height: 1;
}
.entry-del:hover { color: var(--red); background: var(--red-100); }
.slot-free {
  border: 1.5px dashed var(--border); border-radius: 10px;
  padding: 6px 10px; margin-bottom: 5px; color: var(--muted); font-size: 13px;
}
.day-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Übersichtskalender ---------- */
.calendar {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-top: 14px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow {
  text-align: center; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 4px 0; text-transform: uppercase;
}
.cal-day {
  min-height: 84px; border-radius: 10px; border: 1.5px solid var(--border);
  padding: 6px 8px; cursor: pointer; position: relative;
  transition: border-color 0.12s, background 0.12s;
  background: #fff;
}
.cal-day:hover { border-color: var(--blue-500); background: var(--blue-100); }
.cal-day.other { visibility: hidden; cursor: default; }
.cal-day.today { border-color: var(--blue-700); border-width: 2px; }
.cal-num { font-weight: 700; font-size: 13px; }
.cal-day.weekend-day .cal-num { color: var(--blue-500); }
.cal-add {
  position: absolute; top: 4px; right: 8px; color: var(--blue-700);
  font-weight: 700; font-size: 14px; opacity: 0; transition: opacity 0.12s;
  pointer-events: none;
}
.cal-day:hover .cal-add { opacity: 0.7; }
.cal-chip {
  display: block; font-size: 10.5px; font-weight: 700; border-radius: 6px;
  padding: 2px 6px; margin-top: 3px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip:hover { box-shadow: inset 0 0 0 1.5px currentColor; }
.cal-chip.duty.complete, .cal-chip.event.complete { background: var(--green-100); color: var(--green); }
.cal-chip.duty.partial, .cal-chip.event.partial { background: var(--amber-100); color: var(--amber); }
.cal-chip.duty.empty, .cal-chip.event.empty { background: var(--red-100); color: var(--red); }
.cal-chip.event.neutral { background: var(--blue-100); color: var(--blue-700); }
.cal-chip.mtf { background: #e8e3f7; color: #5b3fa8; }
.page-info .cal-chip.demo {
  display: inline-block; margin: 0 2px; cursor: default; vertical-align: -1px;
}
.page-info .cal-chip.demo:hover { box-shadow: none; }
.choice-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.choice-btns .btn { padding: 13px; font-size: 15px; }
.ev-add-row { display: flex; gap: 8px; margin-top: 10px; }
.ev-add-row input { flex: 1; min-width: 0; }
.ev-add-row .btn { white-space: nowrap; flex-shrink: 0; }
.day-card.highlight { animation: cardflash 2.5s; }
@keyframes cardflash {
  0%, 55% { box-shadow: 0 0 0 3px var(--blue-500), var(--shadow); }
  100% { box-shadow: var(--shadow); }
}

/* ---------- Profil ---------- */
.profile-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; max-width: 520px; margin-top: 14px;
}
.level-options { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.radio-chip, .check-chip {
  display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--border);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 400 !important;
  margin: 0 !important; font-size: 14px !important; color: var(--text) !important;
}
.radio-chip:has(input:checked), .check-chip:has(input:checked) {
  border-color: var(--blue-500); background: var(--blue-100);
}
.radio-chip input, .check-chip input { accent-color: var(--blue-700); width: 17px; height: 17px; }
.qual-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 4px; }
.profile-card .btn-primary { margin-top: 18px; }
.saved-msg { color: var(--green); font-weight: 700; margin-left: 12px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 51, 82, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 24px;
  width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  max-height: 85vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 6px; color: var(--blue-900); }
.modal-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.res-detail {
  background: var(--bg); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
}
.modal-quals { grid-template-columns: repeat(4, 1fr); }
.modal-quals .check-chip { padding: 8px 6px; justify-content: center; }
.df-check { margin-top: 14px !important; }

/* ---------- Mitglieder-Vorschlagsliste ---------- */
.picker-wrap { position: relative; }
.picker-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1.5px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 200px; overflow-y: auto;
}
.picker-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; cursor: pointer;
}
.picker-item:hover { background: var(--blue-100); }
.picker-item + .picker-item { border-top: 1px solid var(--border); }
.picker-name { font-weight: 600; }
.picker-chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.picker-hint {
  background: var(--green-100); color: var(--green); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; font-weight: 600; margin: 8px 0 0;
}
.ev-add-row .picker-wrap { flex: 1; min-width: 0; }

/* ---------- Teilen-Link ---------- */
.share-row { display: flex; gap: 8px; margin-top: 10px; }
.share-row input {
  flex: 1; min-width: 0; font-size: 13px; background: var(--bg);
  color: var(--muted);
}
.share-row .btn { white-space: nowrap; flex-shrink: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--blue-900); color: #fff; padding: 12px 22px;
  border-radius: 12px; font-weight: 600; z-index: 200;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3); max-width: 90vw;
}
.toast.error { background: var(--red); }

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
  .weekend-days { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; padding: 10px 12px; }
  .topbar-nav { order: 3; width: 100%; justify-content: space-around; }
  .nav-btn { padding: 8px 10px; font-size: 13px; }
  .brand-text { display: none; }
  .topbar-brand { flex: 1; }
  .cal-day { min-height: 62px; padding: 4px 5px; }
  .cal-chip { font-size: 9px; padding: 2px 4px; }
  main { padding: 16px 12px 50px; }
  .qual-options { grid-template-columns: 1fr; }
}
