/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-light: #dbeafe; --primary-50: #eff6ff;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb; --gray-300: #d1d5db;
  --gray-400: #9ca3af; --gray-500: #6b7280; --gray-600: #4b5563; --gray-700: #374151;
  --gray-800: #1f2937; --gray-900: #111827;
  --red-500: #ef4444; --red-50: #fef2f2; --red-700: #b91c1c;
  --green-500: #22c55e; --green-50: #f0fdf4; --green-700: #15803d;
  --amber-400: #fbbf24; --amber-50: #fffbeb; --amber-500: #f59e0b; --amber-600: #d97706; --amber-800: #92400e;
  --sidebar-w: 260px; --radius: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem;
  --shadow: 0 1px 3px rgba(0,0,0,.1); --shadow-lg: 0 10px 25px rgba(0,0,0,.12);
}
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--gray-50); color: var(--gray-900); line-height: 1.5; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }

/* ── Login ── */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-50), #e0e7ff); }
.login-card { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 2.5rem; max-width: 400px; width: 100%; text-align: center; }
.login-logo { width: 64px; height: 64px; border-radius: var(--radius-lg); display: block; margin: 0 auto 1.5rem; object-fit: contain; padding: 4px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.1); }
.login-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.login-card p { color: var(--gray-500); margin-bottom: 2rem; font-size: .875rem; }
.login-register { margin-top: 1rem; font-size: .875rem; color: var(--gray-500); }
.login-register a { color: var(--primary); font-weight: 600; text-decoration: none; }
.login-register a:hover { text-decoration: underline; }

/* ── Registrierung ── */
.register-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-50), #e0e7ff); padding: 2rem; }
.register-card { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 2.5rem; max-width: 540px; width: 100%; text-align: center; }
.register-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.register-subtitle { color: var(--gray-500); margin-bottom: 1.5rem; font-size: .875rem; }
.register-form { text-align: left; }
.register-form h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; text-align: center; }
.register-form .form-group { margin-bottom: .75rem; }
.register-form .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.register-form .form-actions { display: flex; justify-content: space-between; margin-top: 1.25rem; gap: .5rem; }
.register-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: var(--radius); padding: .625rem .875rem; font-size: .8125rem; margin-top: .75rem; }
.register-back { display: inline-block; margin-top: 1.25rem; font-size: .8125rem; color: var(--gray-500); text-decoration: none; }
.register-back:hover { color: var(--primary); }
.consent-group { margin-bottom: .5rem !important; }
.checkbox-label { display: flex; align-items: flex-start; gap: .5rem; font-size: .875rem; cursor: pointer; line-height: 1.4; }
.checkbox-label input[type="checkbox"] { margin-top: .15rem; flex-shrink: 0; cursor: pointer; accent-color: var(--primary); width: 1rem; height: 1rem; }
.link-btn { background: none; border: none; padding: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font-size: inherit; font-family: inherit; }
.link-btn:hover { color: var(--primary-dark, #1d4ed8); }
.legal-text { font-size: .875rem; line-height: 1.6; color: var(--gray-700); }
.legal-text h3 { font-size: .9375rem; font-weight: 600; margin: 1.25rem 0 .4rem; color: var(--gray-900); }
.legal-text p { margin-bottom: .5rem; }
.legal-text ul, .legal-text ol { padding-left: 1.25rem; margin-bottom: .5rem; }
.legal-text li { margin-bottom: .25rem; }
.legal-meta { color: var(--gray-400); font-size: .8125rem; margin-bottom: 1rem; }
.form-hint { font-size: .75rem; color: var(--gray-400); font-weight: 400; }

/* Stepper */
.register-stepper { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 1.5rem; }
.register-step { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.step-number { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8125rem; font-weight: 600; background: var(--gray-200); color: var(--gray-500); transition: all .2s; }
.register-step.active .step-number { background: var(--primary); color: #fff; }
.register-step.done .step-number { background: #22c55e; color: #fff; }
.step-label { font-size: .75rem; color: var(--gray-500); font-weight: 500; }
.register-step.active .step-label { color: var(--primary); font-weight: 600; }
.register-step.done .step-label { color: #22c55e; }
.step-line { width: 48px; height: 2px; background: var(--gray-200); margin: 0 .5rem; margin-bottom: 1rem; transition: background .2s; }
.step-line.done { background: #22c55e; }

/* Erfolgs-Icon */
.register-success { text-align: center; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: #dcfce7; color: #22c55e; display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto 1rem; }

/* ── Loading ── */
.loading-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.loading-screen p { color: var(--gray-500); }
.spinner { width: 48px; height: 48px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ── Sidebar ── */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--gray-200); display: flex; flex-direction: column; z-index: 30; }
.sidebar-logo { display: flex; align-items: center; gap: .75rem; padding: 1.25rem; border-bottom: 1px solid var(--gray-100); }
.logo-icon { width: 36px; height: 36px; border-radius: var(--radius); display: block; object-fit: contain; padding: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.1); }
.logo-title { font-weight: 600; font-size: .875rem; }
.logo-sub { color: var(--gray-500); font-size: .75rem; }
.sidebar-school { padding: .75rem 1.25rem; border-bottom: 1px solid var(--gray-100); }
.sidebar-school .label { font-size: .625rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); }
.sidebar-school .value { font-size: .875rem; font-weight: 500; color: var(--gray-700); margin-top: .125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { flex: 1; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; }
.nav-link { display: flex; align-items: center; gap: .75rem; padding: .625rem .75rem; border-radius: var(--radius); font-size: .875rem; font-weight: 500; color: var(--gray-600); text-decoration: none; cursor: pointer; transition: all .15s; }
.nav-link:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-link.active { background: var(--primary-light); color: var(--primary-dark); }
.nav-link .icon { width: 1.25rem; height: 1.25rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-link .icon svg { width: 1.25rem; height: 1.25rem; display: block; }
.sidebar-user { padding: 1rem; border-top: 1px solid var(--gray-100); display: flex; align-items: center; gap: .75rem; }
.user-avatar { width: 32px; height: 32px; background: var(--gray-200); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600; color: var(--gray-600); flex-shrink: 0; }
.user-name { flex: 1; font-size: .875rem; font-weight: 500; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main ── */
.main-content { margin-left: var(--sidebar-w); padding: 1.5rem; flex: 1; min-height: 100vh; overflow-x: hidden; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border-radius: var(--radius); font-size: .875rem; font-weight: 500; border: none; cursor: pointer; transition: all .15s; }
.btn svg { width: 1rem; height: 1rem; display: block; flex-shrink: 0; }
.mod-icon { width: 1.25rem; height: 1.25rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mod-icon svg { width: 100%; height: 100%; display: block; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); } .btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-danger { color: var(--red-500); background: none; padding: .25rem .5rem; } .btn-danger:hover { color: var(--red-700); }
.btn-danger-fill { background: var(--red-500); color: #fff; } .btn-danger-fill:hover:not(:disabled) { background: var(--red-700); }
.btn-amber { background: var(--amber-500); color: #fff; } .btn-amber:hover:not(:disabled) { background: var(--amber-600); }
.btn-block { width: 100%; justify-content: center; padding: .75rem; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: .25rem; transition: color .15s; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon svg { width: 1rem; height: 1rem; display: block; }
.btn-icon:hover { color: var(--red-500); }

/* ── Page Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }

/* ── Cards & Panels ── */
.card { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow); border: 1px solid var(--gray-100); }
.card-body { padding: 1.5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.stat-card { padding: 1.5rem; }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.stat-card .stat-icon svg { width: 22px; height: 22px; display: block; }
.stat-card .stat-label { font-size: .875rem; color: var(--gray-500); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; margin-top: .25rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: .75rem 1.5rem; text-align: left; font-size: .75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; background: var(--gray-50); }
tbody td { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); font-size: .875rem; }
tbody tr { cursor: pointer; transition: background .1s; } tbody tr:hover { background: var(--gray-50); }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }

/* ── Tags / Badges ── */
.badge { display: inline-block; padding: .125rem .5rem; border-radius: 9999px; font-size: .75rem; font-weight: 500; }
.badge-green { background: var(--green-50); color: var(--green-700); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.dept-tag { display: inline-block; padding: .125rem .375rem; border-radius: .25rem; font-size: .6875rem; font-weight: 500; color: #fff; margin: .125rem; }
.dept-tag-overflow { display: inline-block; padding: .125rem .375rem; border-radius: .25rem; font-size: .6875rem; font-weight: 500; color: var(--gray-500); background: var(--gray-100); margin: .125rem; cursor: default; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .col-span-2 { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: .25rem; }
.form-group label { font-size: .8125rem; font-weight: 500; color: var(--gray-700); }
.form-group input, .form-group select, .form-group textarea {
  padding: .5rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: .875rem; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; cursor: pointer; }
.checkbox-label input[type="checkbox"], #login-all-header, .row-sel { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }
fieldset { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
fieldset legend { font-size: .8125rem; font-weight: 600; color: var(--gray-700); padding: 0 .5rem; }

/* ── Filter Bar ── */
.filter-bar { display: flex; gap: .75rem; margin-bottom: 1rem; background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); padding: .75rem; }
.filter-bar select { border: 1px solid var(--gray-300); border-radius: var(--radius); padding: .5rem .75rem; font-size: .875rem; }
.filter-bar input[type="search"] { flex: 1; min-width: 0; border: 1px solid var(--gray-300); border-radius: var(--radius); padding: .5rem .75rem; font-size: .875rem; outline: none; }
.filter-bar input[type="search"]:focus { border-color: var(--primary-400); box-shadow: 0 0 0 3px var(--primary-50); }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); max-width: 48rem; width: calc(100% - 2rem); max-height: 90vh; overflow-y: auto; }
.modal.narrow { max-width: 32rem; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-100); position: sticky; top: 0; background: #fff; border-radius: var(--radius-xl) var(--radius-xl) 0 0; z-index: 1; }
.modal-header h2 { font-size: 1.125rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
/* Modal mit fixer Größe – Tabs sichtbar, nur Inhalt scrollt */
.modal.modal-fixed { height: min(92vh, 700px); overflow: hidden; display: flex; flex-direction: column; }
.modal.modal-fixed .modal-header { flex-shrink: 0; }
.modal.modal-fixed .modal-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
.modal.modal-fixed .detail-tabs { flex-shrink: 0; }
.modal.modal-fixed .tab-content-wrap { flex: 1; min-height: 0; overflow-y: auto; }
.modal.modal-fixed .form-actions { flex-shrink: 0; padding: 1rem 0 1.5rem; border-top: 1px solid var(--gray-100); background: #fff; }

/* ── Detail-Tabs ── */
.detail-tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--gray-200); }
.detail-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: .5rem 1rem; margin-bottom: -2px; font-size: .9rem; color: var(--gray-600); cursor: pointer; transition: color .15s; }
.detail-tab:hover { color: var(--primary); }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-content-wrap { min-height: 420px; }

/* ── Einsatz-Zeilen (Planung-Tab) ── */
.assignment-row { padding: .6rem .75rem; border-radius: var(--radius); margin-bottom: .5rem; border: 1px solid var(--gray-200); }
.assignment-row.assignment-past { opacity: .5; }
.assignment-row.assignment-current { border-color: transparent; }

/* ── Fortschritt Balken ── */
.progress-bar-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem; }
.progress-bar-label { width: 120px; font-size: .875rem; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-bar-track { width: 200px; flex-shrink: 0; height: 14px; background: var(--gray-200); border-radius: 8px; overflow: hidden; position: relative; }
.progress-bar-fill { height: 100%; border-radius: 8px; position: absolute; top: 0; left: 0; }
.progress-bar-text { font-size: .8rem; color: var(--gray-600); white-space: nowrap; }

/* ── Alert ── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1rem; }
.alert-error { background: var(--red-50); color: var(--red-700); }

/* ── Quick Links ── */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.quick-link { display: block; padding: 1rem; border: 1px solid var(--gray-200); border-radius: var(--radius); cursor: pointer; transition: all .15s; text-decoration: none; color: inherit; }
.quick-link:hover { border-color: var(--primary); background: var(--primary-50); }
.quick-link .ql-title { font-weight: 500; }
.quick-link .ql-desc { font-size: .8125rem; color: var(--gray-500); margin-top: .25rem; }

/* ── Planning Grid ── */
#planning-grid { flex: 1; min-height: 0; }
.planning-wrapper { background: #fff; border-radius: var(--radius-xl); border: 1px solid var(--gray-200); overflow: auto; height: 100%; }
.planning-wrapper table { border-collapse: collapse; min-width: 100%; }
.planning-wrapper thead { position: sticky; top: 0; z-index: 20; }
.planning-wrapper thead th { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); border-right: 1px solid var(--gray-200); padding: .75rem; text-align: left; white-space: nowrap; }
.planning-wrapper thead th:first-child { position: sticky; left: 0; z-index: 25; min-width: 120px; }
.planning-wrapper tbody td { border-bottom: 1px solid var(--gray-200); border-right: 1px solid var(--gray-200); padding: .25rem; vertical-align: top; min-width: 180px; height: 64px; position: relative; }
.planning-wrapper tbody td:first-child { position: sticky; left: 0; z-index: 10; background: var(--gray-50); min-width: 120px; padding: .5rem; }
.student-header { font-size: .8125rem; font-weight: 600; }
.student-sub { font-size: .6875rem; color: var(--gray-400); }
.kw-label { font-size: .8125rem; font-weight: 600; color: var(--gray-700); }
.kw-dates { font-size: .625rem; color: var(--gray-400); }

.cell-empty { cursor: pointer; transition: background .1s; }
.cell-empty:hover { background: var(--primary-50); }

.assignment-block {
  position: absolute; left: 4px; right: 4px; top: 4px;
  border-radius: .375rem; color: #fff; font-size: .6875rem; font-weight: 500;
  padding: .25rem .5rem; cursor: pointer; z-index: 5; box-shadow: var(--shadow);
  overflow: hidden; transition: box-shadow .15s;
}
.assignment-block:hover { box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 10; }
.assignment-block .ab-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-block .ab-meta { opacity: .85; }
.assignment-block .ab-close {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; align-items: center; padding: 0 6px;
  opacity: 0; cursor: pointer;
  transition: opacity .15s; border-radius: 0 .375rem .375rem 0;
  background: rgba(0,0,0,.15);
}
.assignment-block .ab-close svg, .vacation-block .ab-close svg { width: .875rem; height: .875rem; display: block; }
.assignment-block:hover .ab-close { opacity: 1; }
.assignment-block .ab-close:hover { background: rgba(0,0,0,.35); }

.vacation-block {
  position: absolute; left: 4px; right: 4px; top: 4px;
  border-radius: .375rem; border: 2px solid var(--amber-400); background: var(--amber-50); color: var(--amber-800);
  font-size: .6875rem; font-weight: 500; padding: .25rem .5rem; cursor: pointer; z-index: 4;
}
.vacation-block .ab-close {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; align-items: center; padding: 0 6px;
  opacity: 0; cursor: pointer;
  transition: opacity .15s; border-radius: 0 .375rem .375rem 0;
  background: rgba(251,191,36,.25);
}
.vacation-block:hover .ab-close { opacity: 1; }
.vacation-block .ab-close:hover { background: rgba(251,191,36,.5); }
.vacation-block > svg { width: .6875rem; height: .6875rem; display: inline; vertical-align: middle; flex-shrink: 0; }

/* ── Wochen-Range-Picker ── */
.wrp { font-size: .875rem; user-select: none; }
.wrp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; font-weight: 600; }
.wrp-nav { background: none; border: 1px solid var(--gray-200); cursor: pointer; padding: .25rem .625rem; border-radius: var(--radius); font-size: 1rem; line-height: 1; transition: background .1s; }
.wrp-nav:hover { background: var(--gray-100); }
.wrp table { border-collapse: collapse; width: 100%; }
.wrp th { font-size: .75rem; color: var(--gray-500); padding: .2rem .25rem; text-align: center; }
.wrp th.wrp-kw-th { width: 2.5rem; }
.wrp td { padding: .2rem .3rem; text-align: center; cursor: pointer; }
.wrp td.wrp-kw { font-size: .7rem; color: var(--gray-400); text-align: right; padding-right: .4rem; cursor: default; }
.wrp tr:hover td:not(.wrp-kw) { background: var(--blue-50); }
.wrp tr.wrp-start td:not(.wrp-kw) { background: var(--primary); color: #fff; border-radius: 0; }
.wrp tr.wrp-end td:not(.wrp-kw) { background: var(--primary); color: #fff; border-radius: 0; }
.wrp tr.wrp-in-range td:not(.wrp-kw) { background: var(--blue-50); }
.wrp tr.wrp-start td:not(.wrp-kw):first-of-type { border-radius: var(--radius) 0 0 var(--radius); }
.wrp tr.wrp-end td:not(.wrp-kw):last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.wrp td.wrp-other-month { color: var(--gray-300); }
.wrp-display { font-size: .875rem; color: var(--gray-600); margin-top: .5rem; min-height: 1.25rem; text-align: center; font-weight: 500; }

/* ── Auto-Planung Preview ── */
.assignment-block.preview { border: 2px dashed rgba(255,255,255,.8); opacity: 0.7; pointer-events: none; }
.preview-bar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: var(--blue-50); border: 1px solid var(--blue-200); border-radius: var(--radius); margin-bottom: .5rem; font-size: .875rem; flex-shrink: 0; }
.warning-badge { color: var(--red-500); cursor: pointer; font-size: .8125rem; text-decoration: underline; }
.warning-badge:hover { color: var(--red-700); }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--gray-400); }
.empty-state p { margin-bottom: 1rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Admin code tags ── */
code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: .8125em; }

/* ── API Docs ── */
.api-search-bar { margin-bottom: 1rem; }
.api-search-bar input { width: 100%; padding: .75rem 1rem; border: 1px solid var(--gray-300); border-radius: var(--radius-lg); font-size: .9375rem; font-family: inherit; background: #fff; transition: border-color .15s, box-shadow .15s; }
.api-search-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.api-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; font-size: .8125rem; color: var(--gray-500); align-items: center; }
.api-legend span { display: inline-flex; align-items: center; gap: .375rem; }
.api-group { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-xl); margin-bottom: 1.25rem; overflow: hidden; }
.api-group-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
.api-group-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.api-group-desc { font-size: .8125rem; color: var(--gray-500); margin-top: .125rem; }
.api-endpoints { }
.api-endpoint { border-bottom: 1px solid var(--gray-100); }
.api-endpoint:last-child { border-bottom: none; }
.api-endpoint-summary { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.25rem; cursor: pointer; list-style: none; transition: background .1s; }
.api-endpoint-summary::-webkit-details-marker { display: none; }
.api-endpoint-summary:hover { background: var(--gray-50); }
.api-endpoint[open] > .api-endpoint-summary { background: var(--primary-50); }
.api-method { display: inline-block; min-width: 56px; padding: .125rem .5rem; border-radius: .25rem; font-size: .6875rem; font-weight: 700; color: #fff; text-align: center; letter-spacing: .03em; font-family: 'SF Mono', 'Fira Code', monospace; flex-shrink: 0; }
.api-path { font-size: .875rem; font-weight: 500; color: var(--gray-800); background: none; padding: 0; white-space: nowrap; }
.api-desc { font-size: .8125rem; color: var(--gray-500); margin-left: auto; text-align: right; flex-shrink: 1; }
.api-endpoint-detail { padding: .75rem 1.25rem 1rem; background: var(--gray-50); border-top: 1px solid var(--gray-100); }
.api-detail-table { width: 100%; border-collapse: collapse; }
.api-detail-table td { padding: .375rem 0; vertical-align: top; font-size: .8125rem; border: none; }
.api-detail-table tr { cursor: default; }
.api-detail-table tr:hover { background: transparent; }
.api-detail-label { font-weight: 600; color: var(--gray-600); width: 140px; white-space: nowrap; padding-right: 1rem; }
.api-code-block { display: inline-block; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: .25rem; padding: .25rem .5rem; font-size: .75rem; line-height: 1.5; color: var(--gray-700); word-break: break-all; max-width: 100%; }
.api-auth-badge { display: inline-block; padding: .125rem .5rem; border-radius: 9999px; font-size: .6875rem; font-weight: 500; }
.api-auth-none { background: var(--green-50); color: var(--green-700); }
.api-auth-tenant { background: var(--primary-light); color: var(--primary-dark); }
.api-auth-admin { background: #fef3c7; color: #92400e; }

/* ── Map Page ── */
.map-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; padding: .75rem 1rem; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); margin-bottom: .75rem; }
.map-toolbar-section { display: flex; flex-direction: column; gap: .25rem; }
.map-toolbar-section > label { font-size: .6875rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; }
.map-toolbar-section > input,
.map-toolbar-section > .input-row > input { padding: .375rem .5rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .8125rem; font-family: inherit; }
.map-toolbar-section > input:focus,
.map-toolbar-section > .input-row > input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.map-toolbar-section .input-row { display: flex; align-items: center; gap: .375rem; font-size: .8125rem; color: var(--gray-600); }
.map-toolbar-buttons { flex-direction: row; gap: .375rem; align-self: flex-end; }
.map-toolbar-divider { width: 1px; height: 32px; background: var(--gray-200); align-self: flex-end; margin-bottom: 2px; }
.map-toolbar .dropdown-check-btn { font-size: .8125rem; padding: .375rem 1.5rem .375rem .5rem; }
.mode-toggle { display: flex; border: 1px solid var(--gray-300); border-radius: var(--radius); overflow: hidden; }
.mode-btn { padding: .375rem .75rem; font-size: .8125rem; border: none; background: #fff; cursor: pointer; color: var(--gray-600); line-height: 1.4; }
.mode-btn.active { background: var(--primary); color: #fff; }
.mode-btn:hover:not(.active) { background: var(--gray-50); }
.map-toolbar-search-group { display: flex; align-items: flex-end; min-width: 384px; }
#search-student { padding: .375rem .5rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .8125rem; font-family: inherit; width: 384px; }

.map-body { display: flex; gap: .75rem; height: calc(100vh - 220px); }
.map-container { flex: 1; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--gray-200); min-height: 300px; }
.map-container .leaflet-container { height: 100%; width: 100%; }
.map-sidebar { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; }
.map-list-header { padding: .625rem .75rem; font-size: .8125rem; font-weight: 600; color: var(--gray-700); background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
.map-practice-list { flex: 1; overflow-y: auto; }
.map-list-item { padding: .625rem .75rem; border-bottom: 1px solid var(--gray-100); cursor: pointer; transition: background .1s; }
.map-list-item:hover { background: var(--gray-50); }
.map-list-item.in-range { background: var(--green-50); }
.map-list-item.in-range:hover { background: #dcfce7; }
.map-list-item.highlighted { border-left: 3px solid var(--primary); }
.map-list-item-header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.map-list-item-header strong { font-size: .8125rem; }
.map-list-distance { font-size: .75rem; color: var(--gray-500); white-space: nowrap; }
.map-list-item-meta { font-size: .75rem; color: var(--gray-500); margin-top: .125rem; }
.map-list-item-tags { margin-top: .25rem; }
.map-list-separator { padding: .5rem .75rem; font-size: .75rem; font-weight: 600; color: var(--gray-400); background: var(--gray-100); text-transform: uppercase; letter-spacing: .04em; }
.map-list-item.no-geo { opacity: .55; }
.map-list-item.no-geo:hover { opacity: .75; }
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table td { padding: .375rem .75rem; font-size: .875rem; border-bottom: 1px solid var(--gray-100); }

/* ── Dropdown Checkbox ── */
.dropdown-check { position: relative; display: inline-block; }
.dropdown-check-btn { position: relative; text-align: left; padding: .5rem 1.75rem .5rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .875rem; font-family: inherit; background: #fff; cursor: pointer; color: var(--gray-700); white-space: nowrap; transition: border-color .15s; }
.dropdown-check-btn::after { content: ""; position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); border: 4px solid transparent; border-top: 5px solid var(--gray-400); }
.dropdown-check-btn:hover { border-color: var(--gray-400); }
.dropdown-check-btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.dropdown-check.open .dropdown-check-btn { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.dropdown-check-panel { display: none; position: absolute; top: calc(100% + 4px); right: 0; min-width: 100%; width: max-content; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 1000; max-height: 200px; overflow-y: auto; }
.dropdown-check.open .dropdown-check-panel { display: block; }
.dropdown-check-item { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; font-size: .8125rem; cursor: pointer; transition: background .1s; }
.dropdown-check-item:hover { background: var(--gray-50); }
.dropdown-check-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: .25rem 0; }

/* ── Sidebar Settings (above user) ── */
.sidebar-settings { padding: .25rem .75rem; border-top: 1px solid var(--gray-100); }
.sidebar-settings:empty { display: none; padding: 0; border: none; }

/* ── Radio Group Cards (for settings modal) ── */
.radio-group-card { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem; border: 1px solid var(--gray-200); border-radius: var(--radius); cursor: pointer; transition: all .15s; }
.radio-group-card:hover { border-color: var(--primary); background: var(--primary-50); }
.radio-group-card--active { border-color: var(--primary); background: var(--primary-50); }
.radio-group-card input[type="radio"] { margin-top: .25rem; accent-color: var(--primary); flex-shrink: 0; }

/* ── Warning Box ── */
.warning-box { background: var(--red-50); border: 1px solid #fecaca; border-radius: var(--radius); padding: 1rem 1.25rem; color: var(--red-700); line-height: 1.6; }
.warning-box strong { color: var(--red-700); }
.warning-box ul { color: var(--gray-800); }

/* ── Toast ── */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(1rem); background: var(--gray-800); color: #fff; padding: .625rem 1.25rem; border-radius: var(--radius); font-size: .875rem; font-weight: 500; z-index: 20000; opacity: 0; transition: all .3s ease; pointer-events: none; }
.toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Mobile Header ── */
.mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; background: #fff; border-bottom: 1px solid var(--gray-200); align-items: center; gap: .75rem; padding: 0 1rem; z-index: 35; }
.mobile-nav-toggle { background: none; border: none; cursor: pointer; color: var(--gray-600); padding: .25rem; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius); }
.mobile-nav-toggle svg { width: 1.4rem; height: 1.4rem; display: block; }
.mobile-nav-toggle:hover { background: var(--gray-100); }
.mobile-title { font-weight: 600; font-size: .9375rem; }
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 29; }
.mobile-overlay.overlay-open { display: block; }

/* ── Schüler-Seiten responsive Klassen ── */
.student-contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .75rem; font-size: .9rem; }
.student-stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.student-hours-row { display: flex; align-items: center; gap: .75rem; }
.student-hours-label { font-size: .85rem; min-width: 150px; color: #374151; }
.student-hours-value { font-size: .8rem; color: #6b7280; white-space: nowrap; min-width: 80px; text-align: right; }

/* ── Responsive (≤ 768 px) ── */
@media (max-width: 768px) {
  /* Mobile Header sichtbar */
  .mobile-header { display: flex; }

  /* Sidebar als Overlay-Drawer */
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; z-index: 40; }
  .sidebar.sidebar-open { transform: translateX(0); }

  /* Main Content: kein Links-Offset, Abstand für Mobile Header */
  .main-content { margin-left: 0; padding: 1rem; padding-top: calc(56px + 1rem); }

  /* Page-Header stackt vertikal */
  .page-header { flex-direction: column; align-items: flex-start; gap: .25rem; }
  .page-header h1 { font-size: 1.25rem; }

  /* Card-Padding leicht reduzieren */
  .card-body { padding: 1rem; }

  /* Schüler: Kontaktdaten → 1 Spalte */
  .student-contact-grid { grid-template-columns: 1fr; }

  /* Schüler: Statistik-Kacheln → kompakter (bleiben 3-spaltig) */
  .student-stats-grid { gap: .5rem; }

  /* Schüler: Stunden-Zeilen → umbrechen */
  .student-hours-row { flex-wrap: wrap; gap: .4rem; }
  .student-hours-label { min-width: unset; width: 100%; }
  .student-hours-value { min-width: unset; text-align: left; }

  /* Formular-Grid: 2-spaltig → 1-spaltig */
  .form-grid { grid-template-columns: 1fr; }
  .register-form .form-grid { grid-template-columns: 1fr; }

  /* Filter-Bar: umbrechend */
  .filter-bar { flex-wrap: wrap; }

  /* Toast: volle Breite statt zentriert */
  .toast { left: 1rem; right: 1rem; transform: translateY(1rem); }
  .toast--visible { transform: translateY(0); }
}

/* ── User-Dropdown in der Sidebar ────────────────────────────────────────── */
.sidebar-user { position: relative; }

.user-menu-trigger { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; border-radius: var(--radius); padding: 0.25rem 0.5rem; margin: -0.25rem -0.5rem; transition: background 0.1s; min-width: 0; overflow: hidden; }
.user-menu-trigger:hover { background: var(--gray-100); }

.user-menu-chevron { color: var(--gray-400); flex-shrink: 0; display: flex; align-items: center; }
.user-menu-chevron svg { width: 0.9rem; height: 0.9rem; display: block; }

.user-menu-panel { display: none; position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 180px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 200; }
.user-menu-panel.open { display: block; }

.user-menu-item { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.6rem 0.75rem; font-size: 0.875rem; font-family: inherit; background: none; border: none; cursor: pointer; color: var(--gray-700); text-align: left; transition: background 0.1s; }
.user-menu-item svg { width: 1rem; height: 1rem; flex-shrink: 0; display: block; }
.user-menu-item:hover { background: var(--gray-50); }

/* Passwort-Eingabe mit Sichtbarkeits-Toggle */
.pw-field { position: relative; }
.pw-field input { padding-right: 2.5rem; width: 100%; box-sizing: border-box; }
.pw-toggle { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 0.25rem; line-height: 0; display: flex; align-items: center; }
.pw-toggle svg { width: 1.125rem; height: 1.125rem; display: block; }
.pw-toggle:hover { color: var(--gray-600); }

/* Gruppe aktiv/inaktiv Toggle-Switch */
.group-toggle-switch { position: relative; display: inline-flex; align-items: center; gap: .375rem; cursor: pointer; font-size: .8125rem; color: var(--gray-600); user-select: none; }
.group-toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.group-toggle-track { width: 2rem; height: 1.125rem; background: var(--gray-300); border-radius: 1rem; transition: background .15s; flex-shrink: 0; position: relative; }
.group-toggle-switch input:checked ~ .group-toggle-track { background: var(--green-500); }
.group-toggle-knob { position: absolute; top: .1875rem; left: .1875rem; width: .75rem; height: .75rem; background: #fff; border-radius: 50%; transition: transform .15s; }
.group-toggle-switch input:checked ~ .group-toggle-track .group-toggle-knob { transform: translateX(.875rem); }

