@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Outfit:wght@300;400;500;600&family=JetBrains+Mono:wght@300;400;500&display=swap');

/* ── DESIGN TOKENS ────────────────────────────────────────────────── */
:root {
  --bg:       #06090f;
  --surface:  #0c1220;
  --surface2: #111928;
  --border:   #1c2a3e;
  --border2:  #243450;

  --text:  #f0e8d6;
  --text2: #8899b4;
  --text3: #445570;

  --accent:  #c8a456;
  --accent2: #e0be78;

  --red:    #c44040;
  --orange: #cc7a38;
  --green:  #3a9060;
  --blue:   #3a70b8;
  --purple: #7040b8;
  --teal:   #309898;

  --solo-bg: #120f1e; --solo-border: #6a40b0; --solo-text: #b888f0;
  --stvs-bg: #0b1422; --stvs-border: #3a60b0; --stvs-text: #7aaada;
  --vors-bg: #0b1a10; --vors-border: #3a7840; --vors-text: #78c078;
  --tutt-bg: #0f1318; --tutt-border: #2a3040; --tutt-text: #8898a8;
  --akad-bg: #181208; --akad-border: #7a5820; --akad-text: #c08840;

  --topbar-bg:  rgba(6,9,15,0.92);
  --overlay-bg: rgba(2,4,10,0.78);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.35);
}

/* ── LIGHT THEME ────────────────────────────────────────────────── */
body.light-theme {
  --bg:       #f4f0e8;
  --surface:  #ffffff;
  --surface2: #ede7db;
  --border:   #d8d0c0;
  --border2:  #c4baaa;

  --text:  #1a1610;
  --text2: #5a5044;
  --text3: #9a9080;

  --accent:  #8a5e1a;
  --accent2: #a87828;

  --red:    #b83020;
  --orange: #c46820;
  --green:  #2a7038;
  --blue:   #2a52a0;
  --purple: #5a28a0;
  --teal:   #286868;

  --solo-bg: #f0e8ff; --solo-border: #8a50c8; --solo-text: #5820a0;
  --stvs-bg: #e8f0ff; --stvs-border: #3a58c0; --stvs-text: #1a3880;
  --vors-bg: #e8f4ec; --vors-border: #3a7040; --vors-text: #1a5020;
  --tutt-bg: #f0f0ec; --tutt-border: #909088; --tutt-text: #2a2a28;
  --akad-bg: #faf0e0; --akad-border: #8a6828; --akad-text: #5a3810;

  --topbar-bg:  rgba(244,240,232,0.94);
  --overlay-bg: rgba(10,8,4,0.5);
}
body.light-theme .ev-OA { background: rgba(42,82,160,0.1); color: #1a3880; border: 1px solid rgba(42,82,160,0.22); }
body.light-theme .ev-OS { background: rgba(42,82,160,0.18); color: #0a2878; border: 1px solid rgba(42,82,160,0.28); }
body.light-theme .ev-BO { background: rgba(196,104,32,0.12); color: #8a3c08; border: 1px solid rgba(196,104,32,0.25); }
body.light-theme .ev-VS { background: rgba(90,40,160,0.1); color: #480c88; border: 1px solid rgba(90,40,160,0.22); }
body.light-theme .ev-KO { background: rgba(42,112,56,0.1); color: #1a5820; border: 1px solid rgba(42,112,56,0.22); }
body.light-theme .ev-GP { background: rgba(184,48,32,0.1); color: #8a1210; border: 1px solid rgba(184,48,32,0.22); }
body.light-theme .ev-HP { background: rgba(184,48,32,0.07); color: #a02020; border: 1px solid rgba(184,48,32,0.18); }
body.light-theme .ev-WP { background: rgba(40,104,104,0.1); color: #1a5858; border: 1px solid rgba(40,104,104,0.22); }
body.light-theme .ev-WA { background: rgba(184,112,32,0.1); color: #7a4808; border: 1px solid rgba(184,112,32,0.22); }
body.light-theme .ev-PR { background: rgba(160,32,80,0.1);  color: #800040; border: 1px solid rgba(160,32,80,0.22); }
body.light-theme .ev-DE { background: rgba(96,96,32,0.1);   color: #484810; border: 1px solid rgba(96,96,32,0.22); }
body.light-theme .ev-default { background: rgba(0,0,0,0.06); color: var(--text3); border: 1px solid rgba(0,0,0,0.1); }
body.light-theme .pill-danger { color: #8a1010; }
body.light-theme .pill-wish   { color: #5820a0; }
body.light-theme .nav-item.active { background: rgba(138,94,26,0.08); }
body.light-theme .cal-cell:hover   { background: rgba(138,94,26,0.05); }
body.light-theme .cal-cell.selected { background: rgba(138,94,26,0.09); }
body.light-theme .ftag-dot.frei { background: #2a7038; }
body.light-theme .bar-fill { filter: saturate(1.2); }
body.light-theme input, body.light-theme select, body.light-theme textarea { color-scheme: light; }
body.light-theme .sidebar { border-right-color: var(--border); }
body.light-theme .topbar  { border-bottom-color: var(--border); }

/* ── RESET & BASE ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ───────────────────────────────────────────────────────── */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ──────────────────────────────────────────────────────── */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
/* subtle vertical glow strip */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent 0%, var(--accent) 40%, var(--accent) 60%, transparent 100%);
  opacity: 0.15;
  pointer-events: none;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  line-height: 1;
}
.sidebar-logo .logo-ver {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  margin-top: 3px;
}
.sidebar-logo .logo-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  margin-top: 3px;
  letter-spacing: 0.03em;
}

.nav { flex: 1; padding: 10px 0 16px; overflow-y: auto; }
.nav::-webkit-scrollbar { width: 0; }

.nav-section {
  padding: 18px 20px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  font-weight: 400;
  transition: color 0.12s, background 0.12s;
  position: relative;
}
.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.nav-item.active {
  color: var(--accent);
  background: rgba(200,164,86,0.07);
}
.nav-item.active::after {
  content: '';
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 1px;
}
.nav-item .icon {
  font-size: 12px;
  width: 14px;
  text-align: center;
  opacity: 0.7;
}
.nav-item.active .icon { opacity: 1; }

/* ── MAIN AREA ────────────────────────────────────────────────────── */
.main { flex: 1; overflow-y: auto; background: var(--bg); }
.main::-webkit-scrollbar { width: 4px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── TOPBAR ───────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar-title {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}
.topbar-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  letter-spacing: 0.03em;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── BUTTONS ──────────────────────────────────────────────────────── */
.btn {
  padding: 6px 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 400;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.14s;
  letter-spacing: 0.01em;
}
.btn:hover {
  color: var(--text);
  border-color: var(--text3);
  background: var(--surface);
}
.btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 500;
}
.btn.primary:hover {
  background: var(--accent2);
  border-color: var(--accent2);
}
.btn.danger {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}
.btn.danger:hover {
  background: rgba(196,64,64,0.12);
}
.btn.active {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 500;
}

/* ── PAGE TRANSITIONS ─────────────────────────────────────────────── */
.page { display: none; padding: 28px 32px; }
.page.active {
  display: block;
  animation: fadeUp 0.22s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── CARDS ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ── STATS ROW ────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}
.stat:hover { border-color: var(--border2); }
.stat::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.stat:hover::before { opacity: 0.4; }
.stat-val {
  font-family: 'Cormorant Garamond', serif;
  font-size: 34px;
  font-weight: 300;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.01em;
}
.stat-lbl {
  font-size: 12px;
  color: var(--text2);
  margin-top: 6px;
  font-weight: 400;
}
.stat-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  margin-top: 3px;
  letter-spacing: 0.02em;
}

/* ── MUSICIAN TABLE ───────────────────────────────────────────────── */
.mus-table { width: 100%; border-collapse: collapse; }
.mus-table th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  font-weight: 400;
  padding: 6px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mus-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.mus-table tr:last-child td { border-bottom: none; }
.mus-table tr:hover td { background: rgba(255,255,255,0.02); }

.kuerzel-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  flex-shrink: 0;
}
.rolle-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
}

.bar-wrap { display: flex; align-items: center; gap: 10px; }
.bar {
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  flex: 1;
  min-width: 60px;
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}
.bar-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  width: 48px;
  text-align: right;
  color: var(--text3);
}

/* ── STATUS PILLS ─────────────────────────────────────────────────── */
.pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  letter-spacing: 0.03em;
}
.pill-ok     { background: rgba(58,144,96,0.15);  color: var(--green);  border: 1px solid rgba(58,144,96,0.25); }
.pill-warn   { background: rgba(204,122,56,0.15); color: var(--orange); border: 1px solid rgba(204,122,56,0.25); }
.pill-danger { background: rgba(196,64,64,0.15);  color: #e07070;       border: 1px solid rgba(196,64,64,0.25); }
.pill-absent { background: rgba(58,112,184,0.15); color: var(--blue);   border: 1px solid rgba(58,112,184,0.25); }
.pill-wish   { background: rgba(112,64,184,0.15); color: #b080f0;       border: 1px solid rgba(112,64,184,0.25); }
.pill-krank  { background: rgba(192,57,43,0.2);   color: var(--red);    border: 1px solid rgba(192,57,43,0.4); }
.krank-item  { opacity: 0.7; }

/* ── CALENDAR ─────────────────────────────────────────────────────── */
.cal-nav-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.cal-month-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 400;
  flex: 1;
  color: var(--text);
  letter-spacing: 0.02em;
}
.cal-grid { display: grid; grid-template-columns: 54px repeat(7, 1fr); gap: 2px; }
.cal-az-label {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 5px 3px;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  user-select: none;
  border-radius: var(--radius-sm);
  gap: 3px;
}
.cal-az-label .az-num  { font-size: 9px;  font-weight: 500; color: var(--accent); letter-spacing: 0.04em; }
.cal-az-label .az-wk   { font-size: 13px; font-weight: 500; color: var(--text2); }
.cal-az-label .az-of8  { font-size: 9px;  color: var(--text3); }
.cal-az-label.az-current { background: rgba(200,164,86,0.1); border: 1px solid rgba(200,164,86,0.3); }
.cal-az-label.az-current .az-wk { color: var(--accent); }
.cal-az-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: var(--accent);
  text-align: center; padding: 4px 2px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
}
.cal-dow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text3);
  text-align: center; padding: 4px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.cal-cell {
  min-height: 92px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  position: relative;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.cal-cell:hover { border-color: var(--border2); background: rgba(255,255,255,0.01); }
.cal-cell.other { opacity: 0.25; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.today::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
}
.cal-cell.selected { border-color: var(--accent); background: rgba(200,164,86,0.04); }
.cal-dn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text3); margin-bottom: 5px;
}
.cal-ev {
  font-size: 10px; padding: 2px 5px; border-radius: 3px;
  margin-bottom: 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.5;
}
.ev-OA { background: rgba(58,112,184,0.2);  color: #88aadd; }
.ev-OS { background: rgba(58,112,184,0.32); color: #aac8ff; }
.ev-BO { background: rgba(204,122,56,0.2);  color: #ddaa66; }
.ev-VS { background: rgba(112,64,184,0.2);  color: #b088ee; }
.ev-KO { background: rgba(58,144,96,0.2);   color: #80cc90; }
.ev-GP { background: rgba(196,64,64,0.2);   color: #e08080; }
.ev-HP { background: rgba(196,64,64,0.12);  color: #cc7070; }
.ev-WP { background: rgba(48,152,152,0.18); color: #76cccc; }
.ev-WA { background: rgba(184,112,58,0.22);  color: #e8aa70; }
.ev-PR { background: rgba(184,58,112,0.22);  color: #ee88aa; }
.ev-DE { background: rgba(112,112,58,0.22);  color: #cccc70; }
.ev-default { background: rgba(80,80,80,0.25); color: var(--text3); }

/* ── DETAIL PANEL ─────────────────────────────────────────────────── */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}
.detail-title { font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.detail-dienst {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.detail-dienst:hover { border-color: var(--accent); background: rgba(200,164,86,0.03); }
.detail-dienst-type { font-family: 'JetBrains Mono', monospace; font-size: 10px; width: 30px; }
.detail-dienst-name { flex: 1; font-size: 12px; }
.detail-dienst-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text3); }
.detail-dienst-loc  { font-size: 10px; color: var(--text3); }
.detail-dienst-assigned { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text3); }

/* ── MODAL ────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 540px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s cubic-bezier(.4,0,.2,1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title { font-size: 14px; font-weight: 500; color: var(--text); }
.modal-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text2); margin-top: 2px;
}
.modal-body { padding: 18px 22px; }
/* MK Festbesetzung Cascade-Bar */
#mk-cascade-bar {
  padding: 12px 22px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface2));
  border-top: 2px solid var(--accent);
  gap: 10px;
  flex-wrap: wrap;
  animation: cascadeBarIn 0.2s ease both;
}
@keyframes cascadeBarIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── MUSICIAN CHECK GRID ──────────────────────────────────────────── */
.mus-check-grid { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.mus-check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  background: var(--bg);
}
.mus-check-item:hover { border-color: var(--border2); }
.mus-check-item.checked { border-color: var(--accent); background: rgba(200,164,86,0.05); }
.mus-check-item.absent-item { opacity: 0.35; cursor: not-allowed; }
.mus-check-item.suggested { border-color: rgba(58,144,96,0.4); background: rgba(58,144,96,0.04); }
.mus-check-item input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; flex-shrink: 0; }
.mus-name { flex: 1; font-size: 13px; }
.mus-info { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text3); }
.mus-warn { font-size: 11px; color: var(--orange); }

/* ── ABSENCE / WISH ───────────────────────────────────────────────── */
.absence-list, .wish-list { display: flex; flex-direction: column; gap: 6px; }
.absence-item, .wish-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.absence-name, .wish-name { flex: 1; font-size: 12px; }
.absence-dates { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text3); }
.absence-type  { font-size: 10px; }
.wish-dienst   { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text3); flex: 2; }
.wish-type-badge { font-family: 'JetBrains Mono', monospace; font-size: 10px; }

/* ── FAIRNESS ─────────────────────────────────────────────────────── */
.fairness-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.fb-row { display: flex; align-items: center; gap: 12px; }
.fb-name { font-size: 12px; width: 130px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.fb-fill { height: 100%; border-radius: 4px; transition: width 0.5s cubic-bezier(.4,0,.2,1); }
.fb-count { font-family: 'JetBrains Mono', monospace; font-size: 12px; width: 40px; text-align: right; color: var(--text3); }

/* ── 2/3 RULE ─────────────────────────────────────────────────────── */
.werk-block { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.werk-header { padding: 11px 16px; background: var(--surface2); display: flex; align-items: center; gap: 12px; cursor: pointer; }
.werk-title  { font-size: 13px; font-weight: 500; flex: 1; }
.werk-count  { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text3); }
.werk-body   { padding: 12px 16px; display: none; }
.werk-body.open { display: block; }
.werk-mus-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; }
.werk-mus-name { width: 140px; flex-shrink: 0; }
.werk-fraction { font-family: 'JetBrains Mono', monospace; font-size: 12px; width: 50px; }
.werk-status   { font-size: 11px; }

/* ── FORMS ────────────────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
input, select {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 11px;
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  width: 100%;
  transition: border-color 0.12s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--text3); }
select option { background: var(--surface); }

/* ── TOAST ────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 13px 18px;
  font-size: 12px;
  max-width: 320px;
  transform: translateY(100px); opacity: 0;
  transition: all 0.28s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  box-shadow: var(--shadow);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--green); }
.toast.warning { border-color: var(--orange); }

/* ── SCROLLBAR ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── RUHEZEITEN / FREIE TAGE ──────────────────────────────────────── */
.ruhzeit-warn {
  font-size: 11px; color: var(--red); padding: 3px 0;
  display: flex; align-items: center; gap: 5px;
}
.ftag-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.ftag-row:last-child { border-bottom: none; }
.ftag-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.ftag-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ftag-dot.frei   { background: var(--green); }
.ftag-dot.belegt { background: var(--surface2); border: 1px solid var(--border2); }
.ftag-clickable  { cursor: pointer; transition: filter 0.12s, opacity 0.12s; }
.ftag-clickable:hover { filter: brightness(1.3); }

/* ── LOCKED MODE ──────────────────────────────────────────────────── */
body.locked .admin-only { display: none !important; }
/* sysadmin-only: nur für System-Admin sichtbar (nicht für Planner) */
body:not(.is-sysadmin) .sysadmin-only { display: none !important; }
/* hide-for-sysadmin: für Planner sichtbar, für Sysadmin ausgeblendet */
body.is-sysadmin .hide-for-sysadmin { display: none !important; }
/* buero-also: auch für Büro-Rolle sichtbar (trotz locked-Modus) */
body.is-buero .buero-also { display: flex !important; }

/* ── SAVE INDICATOR ───────────────────────────────────────────────── */
.save-indicator {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text3);
  display: flex; align-items: center; gap: 4px;
  opacity: 0; transition: opacity 0.5s;
  letter-spacing: 0.04em;
}
.save-indicator.show  { opacity: 1; }
.save-indicator.error { color: var(--orange); }

/* ── MEIN PLAN ────────────────────────────────────────────────────── */
.mp-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.mp-toolbar-person {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.mp-person-sel {
  flex: 1; min-width: 140px; max-width: 240px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 6px 11px; font-size: 13px;
}
.mp-toolbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.mp-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ── SEARCH ───────────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-input {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 11px;
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  width: 220px; outline: none;
  transition: border-color 0.15s, width 0.2s;
}
.search-input:focus { border-color: var(--accent); width: 280px; }
.search-input::placeholder { color: var(--text3); }
.search-dropdown {
  display: none; position: absolute;
  top: calc(100% + 6px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 320px; max-height: 300px; overflow-y: auto;
  z-index: 200;
  box-shadow: var(--shadow);
}
.search-dropdown.open { display: block; }
.search-result {
  padding: 9px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-size: 12px;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface2); }
.search-result-type { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--text3); width: 32px; }
.search-result-main { flex: 1; }
.search-result-sub  { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text3); }
.search-empty { padding: 14px; font-size: 12px; color: var(--text3); text-align: center; }

/* ── UNDO BUTTON ──────────────────────────────────────────────────── */
.btn-undo { opacity: 0.35; pointer-events: none; }
.btn-undo.active { opacity: 1; pointer-events: auto; }

/* ── AUTO-EINTEILUNG ──────────────────────────────────────────────── */
.auto-mode-btn.active {
  background: var(--accent); color: var(--bg);
  border-color: var(--accent); font-weight: 500;
}

/* ── MUSICIAN MANAGEMENT ──────────────────────────────────────────── */
.mus-mgmt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.mus-mgmt-row .mus-mgmt-info { flex: 1; }
.mus-mgmt-row .mus-mgmt-name { font-size: 13px; }
.mus-mgmt-row .mus-mgmt-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text3); margin-top: 2px;
}
.rolle-select {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 4px; color: var(--text);
  padding: 3px 8px;
  font-size: 11px; font-family: 'Outfit', sans-serif;
  cursor: pointer;
}

/* ── APP LOADING OVERLAY ──────────────────────────────────────────── */
.loading-note-ring {
  animation: notePulse 1.5s ease-in-out infinite;
  transform-origin: 36px 35px;
}
@keyframes notePulse {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50%       { opacity: 1;   transform: scale(1.06); filter: drop-shadow(0 0 8px rgba(200,164,86,0.5)); }
}
.loading-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.loading-dots::after {
  content: '';
  animation: loadingDots 1.4s steps(4, end) infinite;
}
@keyframes loadingDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* ── CALENDAR CONFLICT BADGES ─────────────────────────────────────── */
.cal-konflikt-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  pointer-events: none;
  flex-shrink: 0;
}
.cal-konflikt-danger { background: var(--red);    box-shadow: 0 0 4px rgba(196,64,64,0.5); }
.cal-konflikt-warn   { background: var(--orange); box-shadow: 0 0 4px rgba(204,122,56,0.4); }
.cal-konflikt-info   { background: var(--blue);   box-shadow: 0 0 4px rgba(58,112,184,0.4); }

/* ── LOGIN: immer Darkmode ─────────────────────────────────────────── */
body.light-theme #login-modal {
  --bg:       #06090f;
  --surface:  #0e1420;
  --surface2: #151c2c;
  --border:   rgba(255,255,255,0.06);
  --border2:  rgba(255,255,255,0.10);
  --text:     #e8e4dc;
  --text2:    #b8b0a4;
  --text3:    #6a6560;
  --accent:   #c8a456;
  --accent2:  #e0bc78;
  --overlay-bg: rgba(3,5,10,0.85);
  color-scheme: dark;
}
body.light-theme #login-modal input,
body.light-theme #login-modal select { color-scheme: dark; }

/* ── LOGIN LOGO ───────────────────────────────────────────────────── */
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 380px;
  max-width: 90vw;
  animation: loginLogoIn 0.9s cubic-bezier(.4,0,.2,1) both;
}
.login-logo-svg {
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0 28px rgba(200,164,86,0.18));
}
.login-note {
  animation: noteBloom 1s cubic-bezier(.4,0,.2,1) 0.1s both;
  transform-origin: 44px 33px;
}
@keyframes noteBloom {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}
.login-staff {
  animation: staffDraw 0.9s ease 0.3s both;
  transform-origin: 44px center;
}
@keyframes staffDraw {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.login-pus {
  animation: loginLogoIn 0.7s ease 0.45s both;
}
@keyframes loginLogoIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 10px;
  text-align: center;
  max-width: 320px;
  line-height: 1.6;
  animation: loginLogoIn 0.6s ease 0.6s both;
}
.login-logo-season {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text3);
  opacity: 0.45;
  letter-spacing: 0.08em;
  margin-top: 4px;
  animation: loginLogoIn 0.6s ease 0.75s both;
}

/* ── DATENSICHERUNG ───────────────────────────────────────────────── */
.backup-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.backup-row .backup-info { flex: 1; font-size: 12px; }
.backup-row .backup-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text3); margin-top: 2px;
}

/* ── MOBILE SIDEBAR BACKDROP ──────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.62);
  z-index: 299;
  backdrop-filter: blur(3px);
}
.mobile-only  { display: none !important; }
.desktop-only { display: flex; }
.mobile-bottom-nav { display: none; }

/* ── RESPONSIVE (≤ 767px) ─────────────────────────────────────────── */
@media (max-width: 767px) {
  .mobile-only  { display: flex !important; }
  .desktop-only { display: none  !important; }

  .shell { flex-direction: row; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 270px; height: 100vh; z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.7);
  }
  .sidebar-backdrop.open { display: block; }

  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar-sub { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions > .btn:not(#lock-btn):not(#theme-toggle-btn) { display: none; }
  .topbar-actions > .search-wrap { display: none; }
  .save-indicator { display: none !important; }

  .mobile-menu-btn {
    background: transparent; border: none;
    color: var(--text2); font-size: 20px;
    padding: 4px 8px; cursor: pointer;
    flex-shrink: 0; line-height: 1;
  }
  .mobile-menu-btn:hover { color: var(--text); }

  .page { padding: 14px 14px 90px; }

  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 12px; }
  .stat { padding: 10px 9px; }
  .stat-val { font-size: 24px; }
  .stat-lbl { font-size: 10px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat-sub { font-size: 9px; display: none; }

  .card { padding: 14px; }

  #page-dashboard .dash-two-col { display: flex !important; flex-direction: column; gap: 12px; }

  .mp-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .mp-toolbar-person { width: 100%; }
  .mp-person-sel { max-width: 100%; }
  .mp-toolbar-actions { justify-content: flex-start; }
  .mp-two-col { grid-template-columns: 1fr; gap: 10px; }

  #z-list, #heatmap-content, #monat-matrix { overflow-x: auto; }

  /* Einteiler-Formular: 1 Spalte statt 4 */
  #new-planner-form { grid-template-columns: 1fr !important; }
  #new-planner-form > button { width: 100%; }

  #page-fairness > div[style*="grid-template-columns"] {
    display: flex !important; flex-direction: column; gap: 12px;
  }

  #nav-konflikte-badge { font-size: 8px; padding: 1px 4px; }

  .mus-table { font-size: 11px; }
  .mus-table th, .mus-table td { padding: 7px 8px; }
  .card > .mus-table { display: block; overflow-x: auto; }

  /* ── Kalender: Bildschirm ausfüllen ── */
  #page-kalender.active {
    display: flex !important;
    flex-direction: column;
    height: calc(100dvh - 54px - 52px - env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    padding: 10px 8px 4px;
  }
  #page-kalender .cal-nav-row { flex-shrink: 0; margin-bottom: 10px; }
  #page-kalender #cal-dows    { flex-shrink: 0; }
  #page-kalender #cal-grid    { flex: 1; min-height: 0; grid-auto-rows: 1fr; margin-top: 1px !important; }
  #page-kalender .cal-cell    { min-height: 0; }
  #page-kalender #cal-detail  { flex-shrink: 0; overflow-y: auto; max-height: 38vh; }

  .cal-grid { grid-template-columns: 36px repeat(7, 1fr); gap: 1px; }
  .cal-cell { min-height: 52px; padding: 3px 4px; border-radius: 4px; }
  .cal-dn   { font-size: 10px; }
  .cal-ev   { font-size: 8px; padding: 1px 3px; margin-bottom: 1px; }
  .cal-az-label .az-num { font-size: 9px; }
  .cal-az-label .az-wk  { font-size: 11px; }

  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }

  .fb-name  { width: 90px; font-size: 11px; }
  .fb-count { width: 32px; font-size: 11px; }

  .form-row { grid-template-columns: 1fr; gap: 10px; }

  #profile-grid { grid-template-columns: 1fr !important; }

  .absence-item, .wish-item { flex-wrap: wrap; gap: 6px; }

  /* ── Zuweisung: Dienst-Karten mobil ── */
  #z-list .detail-dienst { flex-wrap: wrap; gap: 5px 8px; padding: 10px 12px; }
  #z-list .detail-dienst .detail-dienst-name { flex: 0 0 100%; font-size: 13px; font-weight: 500; order: 0; }
  #z-list .detail-dienst .detail-dienst-assigned { flex: 0 0 100%; order: 4; font-size: 11px; }
  #z-list .detail-dienst .detail-dienst-loc { display: none; }
  #z-list .detail-dienst .detail-dienst-time { order: 1; font-size: 11px; }

  .toast {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 8px);
    right: 14px; left: 14px;
    max-width: none; text-align: center;
    border-radius: var(--radius);
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mbn-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 7px 4px 6px;
    cursor: pointer; color: var(--text3);
    font-size: 10px; gap: 3px;
    transition: color 0.14s, background 0.14s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
  }
  .mbn-item:active { background: var(--surface2); }
  .mbn-item.active { color: var(--accent); }
  .mbn-icon  { font-size: 19px; line-height: 1; }
  .mbn-label { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.04em; }
  .mbn-badge {
    position: absolute; top: 4px; right: calc(50% - 18px);
    background: var(--red); color: #fff;
    border-radius: 8px; font-size: 8px; padding: 1px 4px;
    font-family: 'JetBrains Mono', monospace; pointer-events: none;
  }

  /* ── Login-Modal: iPhone-Skalierungsfehler + große Schrift ── */
  #login-modal {
    /* Kein flex-end (bottom-sheet) für Login */
    align-items: center;
    justify-content: flex-start;
    /* 100dvh = echte sichtbare Höhe auf iPhone (ohne Browser-Chrome) */
    min-height: 100dvh;
    height: 100dvh;
    overflow-y: auto;
    /* Safe-Area-Insets für Notch + Home-Bar */
    padding: env(safe-area-inset-top, 24px) 16px env(safe-area-inset-bottom, 24px);
    box-sizing: border-box;
    gap: 20px;
  }
  /* Login-Karte: volle Breite, keine harte max-width */
  #login-modal > .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
    margin: 0;
    box-sizing: border-box;
  }
  /* Logo: etwas kleiner damit alles passt */
  .login-logo { width: 100%; max-width: 100%; }
  .login-logo-svg { width: 180px; height: auto; }
  /* Logo-Untertitel lesbarer */
  .login-logo-sub  { font-size: 14px; }
  .login-logo-season { font-size: 13px; }
  /* Tab-Buttons: gut tippbar */
  #login-tab-musician,
  #login-tab-buero,
  #login-tab-planner,
  #login-tab-sysadmin {
    font-size: 15px !important;
    padding: 10px 4px;
    min-height: 44px;
  }
  /* Labels deutlich größer */
  #login-modal .form-label { font-size: 16px; }
  /* Beschreibungstext in den Panels */
  #login-modal p { font-size: 14px !important; }
  /* Inputs: 16px verhindert Auto-Zoom auf iOS, größere Touch-Targets */
  #login-modal input[type="text"],
  #login-modal input[type="password"],
  #login-modal input[type="email"] {
    font-size: 16px !important;
    padding: 14px 16px;
    min-height: 50px;
    box-sizing: border-box;
  }
  /* Anmelden-Button: gut tippbar */
  #login-modal .btn.primary {
    font-size: 17px;
    padding: 12px 28px;
    min-height: 48px;
  }
  /* Fehlermeldungen lesbarer */
  #login-modal .login-error { font-size: 14px !important; }
  /* PIN-Eingabe groß und deutlich */
  #login-pin-buero,
  #login-pin-planner,
  #login-pin-sysadmin {
    font-size: 28px !important;
    letter-spacing: 0.35em;
    padding: 14px 16px;
    min-height: 56px;
  }
}

/* ─── PRINT ───────────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .sidebar-backdrop, .app-header, .mobile-bottom-nav,
  .mp-toolbar, .nav, #section-switcher, .btn, button,
  .modal-overlay, #app-loading, #login-modal,
  #cal-nav, .no-print { display: none !important; }

  body {
    background: #fff !important;
    color: #111 !important;
    font-family: 'Georgia', serif;
    font-size: 11pt;
  }

  .main-content { margin: 0 !important; padding: 8pt !important; }
  .page { display: block !important; padding: 0 !important; }

  .card {
    border: 1pt solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #111 !important;
    break-inside: avoid;
    margin-bottom: 10pt;
  }

  .card-title { color: #111 !important; border-bottom: 0.5pt solid #ccc !important; }

  .cal-cell { border: 0.5pt solid #ddd !important; background: #fff !important; color: #111 !important; }
  .cal-cell.today { background: #f5f0e8 !important; }

  #z-list .detail-dienst { border-bottom: 0.5pt solid #ddd !important; color: #111 !important; }

  @page { margin: 1.5cm; size: A4 portrait; }
}
