/* Admin-/Mitarbeiterbereich – helles Theme
   (Kundenportal bleibt dunkel; hier werden nur die Tokens gekippt) */
html { color-scheme: light; }

body.admin {
  --bg0: #f6f7f9;      /* Seite */
  --bg1: #ffffff;      /* Fläche */
  --bg2: #eff1f4;      /* erhöht / hover */
  --bg3: #e4e7ec;      /* aktiv */
  --line: rgba(17, 24, 39, .08);
  --line-strong: rgba(17, 24, 39, .17);
  --text: #16181d;
  --muted: #5c6470;
  --faint: #757e8b;
  --red: #d91f2a;      /* leicht dunkler für Kontrast auf Weiß */
  --red-hover: #b81a23;
  --red-soft: rgba(217, 31, 42, .08);
  --ok: #1a7f37;
  --ok-soft: rgba(26, 127, 55, .09);
  --warn: #9a6700;
  --warn-soft: rgba(154, 103, 0, .09);
  background: var(--bg0);
}

/* Hell-Anpassungen für Werte, die im dunklen Basis-Stylesheet hartkodiert sind */
body.admin ::selection { background: var(--red); color: #fff; }
body.admin .notice.ok { color: var(--ok); }
body.admin .notice.err { color: #c11622; }
body.admin table.data tr:hover td { background: rgba(17, 24, 39, .025); }
body.admin .day-slot .bar,
body.admin .cal-day .loadbar { background: rgba(17, 24, 39, .09); }
body.admin .tag.einzel { color: #0969da; }
body.admin .tag.gruppe { color: #8250df; }
body.admin .cal-day .b-tag { background: var(--red-soft); color: #c11622; }
body.admin .cal-day .g-tag { background: rgba(130, 80, 223, .1); color: #8250df; }
body.admin .modal-back { background: rgba(16, 24, 40, .4); }
body.admin .modal { box-shadow: 0 24px 60px rgba(16, 24, 40, .18); }
body.admin .toast-item { background: #fff; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); }
body.admin .sidebar { background: var(--bg1); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .logo { justify-content: center; margin-bottom: 22px; }
.login-card h3 { text-align: center; }

.app { display: none; min-height: 100vh; }
.app.on { display: grid; grid-template-columns: 220px 1fr; }
@media (max-width: 900px) { .app.on { grid-template-columns: 1fr; } .sidebar { position: static !important; height: auto !important; border-right: 0 !important; border-bottom: 1px solid var(--line); } }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg0); border-right: 1px solid var(--line);
  padding: 18px 10px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar .logo { padding: 0 10px 20px; font-size: .82rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  padding: 8px 12px; border-radius: var(--radius-s); font-size: .82rem; font-weight: 500;
  color: var(--muted); display: flex; align-items: center; gap: 10px; position: relative;
  transition: color .15s, background-color .15s;
}
.sidebar nav a .icon { width: 15px; height: 15px; opacity: .75; }
.sidebar nav a .badge { margin-left: auto; }
.sidebar nav a:hover { background: var(--bg1); color: var(--text); }
.sidebar nav a.active { background: var(--bg2); color: var(--text); }
.sidebar nav a.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  border-radius: 2px; background: var(--red);
}
.sidebar nav a.active .icon { opacity: 1; }
.sidebar nav a .badge {
  background: var(--red); color: #fff; font-size: .64rem; font-weight: 600;
  padding: 1px 7px; border-radius: 99px; font-variant-numeric: tabular-nums;
}
.sidebar .user-box { border-top: 1px solid var(--line); padding: 14px 12px 4px; font-size: .76rem; color: var(--muted); }
.sidebar .user-box strong { color: var(--text); display: block; font-weight: 550; }
.sidebar .user-box a { font-weight: 500; }

/* ---------- Inhalt ---------- */
main.content { padding: 28px 32px; max-width: 1180px; }
main.content h1 { font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: .84rem; margin-bottom: 24px; max-width: 78ch; }

/* Statistik-Kacheln */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 1.35rem; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .l { font-size: .7rem; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ---------- Tabellen ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.data th {
  text-align: left; color: var(--faint); font-size: .66rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line-strong);
}
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: rgba(255, 255, 255, .015); }
table.data .actions { white-space: nowrap; text-align: right; }
table.data strong { font-weight: 600; }

/* Status: Punkt + Text */
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 500;
  color: var(--muted); white-space: nowrap;
}
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.tag.confirmed { color: var(--ok); }
.tag.pending { color: var(--warn); }
.tag.cancelled { color: var(--faint); }
.tag.rejected { color: var(--red); }
.tag.gruppe { color: #b78bef; }
.tag.einzel { color: #58a6ff; }
.tag.reason { color: var(--muted); }

/* ---------- Tagesplan-Slots ---------- */
.day-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 7px; margin-bottom: 20px; }
.day-slot { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 9px; background: var(--bg1); }
.day-slot .t { font-weight: 600; font-size: .82rem; font-variant-numeric: tabular-nums; }
.day-slot .bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.07); margin: 7px 0 5px; overflow: hidden; }
.day-slot .bar i { display: block; height: 100%; background: var(--ok); border-radius: 2px; }
.day-slot.warn .bar i { background: var(--warn); }
.day-slot.full .bar i { background: var(--red); }
.day-slot .f { font-size: .64rem; color: var(--muted); }
.day-slot.blocked { opacity: .5; }
.day-slot.blocked .bar i { background: var(--faint); }
.day-slot.exclusive { border-color: rgba(229, 35, 46, .4); background: var(--red-soft); }
.day-slot.exclusive .bar i { background: var(--red); }

/* ---------- Kalender ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h3 { font-size: .95rem; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: .64rem; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 4px 0; }
.cal-day {
  min-height: 84px; border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 7px 8px; background: var(--bg1); cursor: pointer; font-size: .7rem;
  display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, background-color .15s;
}
.cal-day:hover { border-color: var(--faint); background: var(--bg2); }
.cal-day .num { font-weight: 600; font-size: .8rem; font-variant-numeric: tabular-nums; }
.cal-day.closed { opacity: .42; background: transparent; }
.cal-day.today { border-color: var(--red); }
.cal-day.today .num { color: var(--red); }
.cal-day .mini { font-size: .62rem; color: var(--faint); }
.cal-day .loadbar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: auto; }
.cal-day .loadbar i { display: block; height: 100%; border-radius: 2px; }
.cal-day .b-tag, .cal-day .g-tag, .cal-day .p-tag {
  font-size: .58rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; align-self: flex-start;
}
.cal-day .b-tag { background: var(--red-soft); color: #ff8b91; }
.cal-day .g-tag { background: rgba(183, 139, 239, .14); color: #b78bef; }
.cal-day .p-tag { background: var(--warn-soft); color: var(--warn); }

/* ---------- Filterleiste ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filter-bar .field { margin-bottom: 0; min-width: 128px; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(5, 6, 8, .7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--bg1); border: 1px solid var(--line-strong); border-radius: var(--radius);
  max-width: 600px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.modal h3 { margin-bottom: 16px; font-size: 1rem; font-weight: 600; }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
  background: var(--bg2); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 11px 16px 11px 14px; font-size: .82rem; max-width: 380px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); animation: slidein .18s ease;
  display: flex; align-items: baseline; gap: 10px;
}
.toast-item::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; transform: translateY(-1px); }
.toast-item.err::before { background: var(--red); }
.toast-item.warn::before { background: var(--warn); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Diverses ---------- */
.hours-row { display: grid; grid-template-columns: 40px auto 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 6px; font-size: .82rem; }
.inline-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: .82rem; color: var(--text); font-weight: 450; }
.inline-check input { width: auto; accent-color: var(--red); }
.section-gap { margin-top: 26px; }
