:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --border: #e5e5ea;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #eef1f5 0%, #e4e7ec 100%);
}
.login-card {
  width: 380px;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 40px 36px;
  text-align: center;
}
.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
}
.login-card p.sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 28px;
}
.field {
  text-align: left;
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fbfbfd;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button:active, .btn:active { transform: scale(0.98); }
button.secondary, .btn.secondary {
  background: #eef0f2;
  color: var(--text);
}
button.secondary:hover { background: #e2e4e7; }
button.danger { background: var(--red); }
button:disabled { opacity: .45; cursor: not-allowed; }

.error-msg {
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}
.hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 18px;
  line-height: 1.5;
}

/* ---------- App-Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #fbfbfd;
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  font-size: 15px;
  font-weight: 600;
  padding: 8px 10px 18px;
}
.sidebar .brand span { display: block; font-size: 11px; color: var(--text-secondary); font-weight: 400; margin-top: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: #eef0f2; }
.nav-item.active { background: var(--accent); color: white; }
.sidebar .spacer { flex: 1; }
.user-box {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.user-box b { color: var(--text); display:block; font-size: 13px; }
.user-box .logout { color: var(--accent); cursor: pointer; margin-top: 6px; display: inline-block; }

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
}
.main h2 { font-size: 24px; font-weight: 600; margin: 0 0 4px; }
.main .subtitle { color: var(--text-secondary); font-size: 14px; margin: 0 0 24px; }

.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}
.badge.wunsch { background: #e6f4ea; color: #1e7e34; }
.badge.ausschluss { background: #fde8e8; color: #c0262d; }
.badge.haus { background: #e8f0fe; color: #1a56db; }
.badge.intensiv { background: #fdeee0; color: #b45309; }
.badge.gray { background: #eef0f2; color: var(--text-secondary); }

.day-cell {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 10.5px;
  margin: 1px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.day-cell.neutral { background: #f5f5f7; color: var(--text-secondary); }
.day-cell.wunsch { background: var(--green); color: white; }
.day-cell.ausschluss { background: var(--red); color: white; }
.day-cell.weekend-border { border-color: #d0d0d5; }
.day-cell.locked { cursor: not-allowed; opacity: .5; }

.station-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.station-row:last-child { border-bottom: none; }
.station-label { width: 130px; flex-shrink: 0; font-weight: 600; font-size: 13px; }
.station-label .sub { display:block; font-weight: 400; color: var(--text-secondary); font-size: 11px; }
.doctor-line { display:flex; align-items:center; gap: 8px; margin-bottom: 4px; font-size: 12.5px; }
.doctor-line .kuerzel { width: 90px; flex-shrink:0; font-weight:500; }
.tag-dot { width: 18px; height: 18px; border-radius: 5px; display:inline-flex; align-items:center; justify-content:center; font-size:9px; color:white; }
.tag-dot.anwesend { background: #d2f4dc; color:#1e7e34; }
/* Dienst (heute im Einsatz) - gut sichtbar rot mit fettem weißem "D", deutlich abgesetzt von
   "dienstfrei" (Ruhetag nach Dienst), damit beide nicht mehr verwechselt werden können. */
.tag-dot.dienst { background: var(--red); color:#fff; font-weight:800; }
.tag-dot.dienstfrei { background: #ff9500; color:#fff; font-weight:600; font-size:7.5px; }
.tag-dot.urlaub { background: #fde68a; color:#92400e; }
.tag-dot.we { background: #f0f0f2; color:#c7c7cc; }
/* ITS-Tagdienst (8-16 Uhr, separater Plan) - grün mit fettem weißem "T", gut unterscheidbar von
   Dienst (rot), Urlaub (gelb) und Dienstfrei (orange). */
.tag-dot.tagdienst { background: var(--green); color:#fff; font-weight:800; }

.day-header-row { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.day-header-cell {
  width: 18px; height: 18px; border-radius: 5px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size: 9px; font-weight: 700; color: var(--text-secondary);
}
.day-header-cell.we { background: #e5e5ea; color: var(--text); }
/* Gesetzlicher Feiertag (Bayern) - lila Markierung, gut unterscheidbar von der grauen
   Wochenend-Markierung, damit Feiertage in Übersichten und Kalendern sofort auffallen. */
.day-header-cell.feiertag { background: #8e6bd8; color: #fff; }
.day-cell.feiertag-border { border: 2px solid #8e6bd8; }

.check-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.check-icon.ok { background: #d2f4dc; color: #1e7e34; }
.check-icon.fail { background: #fde8e8; color: #c0262d; }

.wish-dot { width: 18px; height: 18px; border-radius: 5px; display:inline-flex; align-items:center; justify-content:center; font-size:9px; color:white; }
.wish-dot.wunsch { background: var(--green); }
.wish-dot.ausschluss { background: var(--red); }
.wish-dot.neutral { background: #f5f5f7; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text); color: white;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(10px);
  transition: all .25s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }

.legend { display:flex; gap: 16px; font-size: 12px; color: var(--text-secondary); margin-top: 10px; flex-wrap: wrap; }
.legend span { display:inline-flex; align-items:center; gap:6px; }
.legend .dot { width:12px; height:12px; border-radius:4px; display:inline-block; }

.deadline-banner {
  background: #fff4e5;
  border: 1px solid #ffe0a3;
  color: #92400e;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
}
.deadline-banner.closed { background: #fde8e8; border-color: #f8c7c7; color: #c0262d; }
