/* FL Buddy 7 – zentraler Master/Detail Split-Workspace */
:root{--flb-detail-width:clamp(430px,42vw,760px);--flb-detail-gap:10px}
@media (min-width:1101px){
 body:has(.flb-split-target.show) .main-content,body:has(.flb-split-target.open) .main-content,body:has(.flb-split-target:not([hidden])[aria-hidden="false"]) .main-content{margin-right:calc(var(--flb-detail-width) + var(--flb-detail-gap))!important;width:auto!important;transition:margin-right .18s ease;min-width:0!important}
 .flb-split-target.show,.flb-split-target.open,.flb-split-target:not([hidden])[aria-hidden="false"]{position:fixed!important;top:100px!important;right:10px!important;bottom:10px!important;left:auto!important;width:var(--flb-detail-width)!important;height:auto!important;min-height:0!important;max-height:none!important;display:block!important;padding:0!important;margin:0!important;background:transparent!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;z-index:180!important;overflow:hidden!important;pointer-events:none!important}
 .flb-split-target.show>*,.flb-split-target.open>*,.flb-split-target:not([hidden])[aria-hidden="false"]>*{pointer-events:auto!important;position:relative!important;inset:auto!important;width:100%!important;max-width:none!important;height:100%!important;max-height:none!important;margin:0!important;border-radius:16px!important;overflow:auto!important;scrollbar-width:none!important;box-sizing:border-box!important;box-shadow:none!important;border:1px solid var(--flb-light-line, #28535b)!important;background:var(--flb-light-surface, #0b3037)!important}
 .flb-split-target.show>*::-webkit-scrollbar,.flb-split-target.open>*::-webkit-scrollbar{display:none!important}
 #appointmentModal .appointment-modal{padding:18px 16px 14px!important}
 #appointmentModal .appointment-modal-head{padding-bottom:10px!important;margin-bottom:0!important;align-items:center!important;position:sticky!important;top:0!important;background:var(--flb-light-surface, #0b3037)!important;z-index:5!important}
 #appointmentModal .appointment-modal-head h2{font-size:21px!important;margin:2px 0 3px!important}
 #appointmentModal .appointment-modal-head p{margin:0!important}
 #appointmentModal .appointment-modal-head button{flex:0 0 auto!important;margin:0 1px 0 8px!important}
 #appointmentModal .appointment-type-grid{grid-template-columns:repeat(6,minmax(0,1fr))!important;gap:5px!important;margin:10px 0!important}
 #appointmentModal .appointment-type{padding:7px 3px!important;border-radius:11px!important;gap:2px!important;min-width:0!important}
 #appointmentModal .appointment-type .type-icon{width:27px!important;height:27px!important;border-radius:8px!important}
 #appointmentModal .appointment-type .type-icon svg{width:14px!important;height:14px!important}
 #appointmentModal .appointment-type strong{font-size:8px!important;white-space:nowrap!important}
 #appointmentModal .appointment-type small{display:none!important}
 #appointmentModal .appointment-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px 10px!important}
 #appointmentModal .field-wide{grid-column:1/-1!important}
 #appointmentModal .field input,#appointmentModal .field select,#appointmentModal .field textarea{margin-top:4px!important;padding:9px 10px!important}
 #appointmentModal .field .input-with-icon input{padding-left:46px!important}
 #appointmentModal .field textarea{min-height:52px!important}
 #appointmentModal .appointment-options{grid-template-columns:1fr!important}
 #appointmentModal .appointment-check,#appointmentModal .appointment-warning{margin-top:8px!important;padding:9px 11px!important}
 #appointmentModal .appointment-actions{position:sticky!important;bottom:-14px!important;background:var(--flb-light-surface, #0b3037)!important;padding:9px 0 1px!important;margin-top:10px!important;z-index:4!important}
 body.flb7-workspace #fullStudentRecordModal.show{top:88px!important;right:10px!important;bottom:10px!important;left:auto!important;width:var(--flb-detail-width)!important;height:auto!important;padding:0!important;background:transparent!important;z-index:180!important}
 body.flb7-workspace #fullStudentRecordModal.show .student-record-modal.flb-record-workspace{height:100%!important;min-height:0!important;border-radius:16px!important;overflow:auto!important;scrollbar-width:none!important}
 /* Kalender: verfügbare Breite/Höhe nutzen, keine sichtbaren Standard-Scrollleisten. */
 #page-kalender .calendar-layout{grid-template-columns:minmax(0,1fr) clamp(190px,18vw,260px)!important;gap:10px!important;min-width:0!important}
 #page-kalender .week-calendar{height:calc(100dvh - 235px)!important;max-height:none!important;overflow-y:auto!important;overflow-x:hidden!important;scrollbar-width:none!important;min-width:0!important}
 html body #page-kalender .week-calendar::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}
 html body #page-kalender .week-calendar{scrollbar-width:none!important;-ms-overflow-style:none!important}
 #page-kalender .calendar-grid{min-width:0!important;width:100%!important;grid-template-columns:clamp(38px,4vw,54px) repeat(6,minmax(0,1fr))!important}
 #page-kalender .day-head{padding:8px 3px!important;min-width:0!important}
 #page-kalender .cal-event{left:3px!important;right:3px!important;padding-left:6px!important;padding-right:6px!important}
 #page-kalender .cal-event.flb-booked-event{border:2px solid var(--flb-light-outline, #e89a35)!important;box-shadow:0 0 0 1px rgba(232,154,53,.22),0 7px 16px rgba(2,20,25,.12)!important}
 #page-kalender .sunset-line{display:block!important;opacity:1!important;z-index:7!important;border-top:2px dashed var(--flb-light-outline, #e3a03d)!important;background:transparent!important}
 #page-kalender .sunset-line span{background:var(--flb-light-amber-soft, #8a5b1f)!important;color:var(--flb-light-ink, #fff)!important;font-weight:800!important;z-index:8!important}
}
@media (min-width:1101px) and (max-width:1450px){
 :root{--flb-detail-width:clamp(420px,40vw,620px)}
 #page-kalender .calendar-layout{grid-template-columns:minmax(0,1fr)!important}
 #page-kalender .calendar-side{display:none!important}
 #appointmentModal .appointment-type-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
 #appointmentModal .appointment-type small{display:block!important;font-size:7px!important}
}
@media(max-width:1100px){.flb-split-target.show,.flb-split-target.open,.flb-split-target:not([hidden])[aria-hidden="false"]{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}}

/* FL Buddy 7 – Fix 4: Theorie ebenfalls im rechten Detailbereich */
@media (min-width:1101px){
 body.flb-theory-detail-open .main-content{margin-right:calc(var(--flb-detail-width) + var(--flb-detail-gap))!important;width:auto!important;min-width:0!important;transition:margin-right .18s ease}
 #theoryLiveBackdrop:not([hidden]){position:fixed!important;top:100px!important;right:10px!important;bottom:10px!important;left:auto!important;width:var(--flb-detail-width)!important;height:auto!important;display:block!important;padding:0!important;margin:0!important;background:transparent!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;z-index:181!important;overflow:hidden!important}
 #theoryLiveBackdrop:not([hidden]) .theory-live-modal{position:relative!important;inset:auto!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;margin:0!important;padding:18px 16px 14px!important;border-radius:16px!important;overflow:auto!important;scrollbar-width:none!important;box-sizing:border-box!important;box-shadow:none!important;border:1px solid var(--flb-light-line, #28535b)!important;background:#0b3037!important}
 #theoryLiveBackdrop:not([hidden]) .theory-live-modal::-webkit-scrollbar{display:none!important}
 #theoryLiveBackdrop .theory-live-modal>header{position:sticky!important;top:-18px!important;z-index:6!important;background:#0b3037!important;padding:12px 0 10px!important;margin:0 0 8px!important;align-items:center!important}
 #theoryLiveBackdrop .theory-live-modal>header h2{font-size:21px!important;margin:2px 0!important}
 #theoryLiveBackdrop .theory-live-modal>header button{width:40px!important;height:40px!important;border-radius:12px!important;flex:0 0 40px!important}
 #theoryLiveBackdrop .theory-live-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px 10px!important}
 #theoryLiveBackdrop .theory-live-grid label.wide{grid-column:1/-1!important}
 #theoryLiveBackdrop .theory-live-grid input,#theoryLiveBackdrop .theory-live-grid select{min-height:44px!important;padding:9px 10px!important}
 #theoryLiveBackdrop .theory-live-students{margin-top:12px!important}
 #theoryLiveBackdrop #theoryLiveStudentChoices{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important}
 #theoryLiveBackdrop .theory-live-modal footer{position:sticky!important;bottom:-14px!important;background:#0b3037!important;padding:10px 0 1px!important;margin-top:10px!important;z-index:5!important}

 /* Tätigkeiten: nur tätigkeitsbezogene Felder, Auswahlkachel zeigt den aktiven Zustand zuverlässig. */
 #appointmentModal .appointment-type:has(input:checked){border-color:var(--flb-light-outline, #2ed6c3)!important;box-shadow:inset 0 0 0 1px #2ed6c3!important;background:var(--flb-light-raised, #10434a)!important}
 #appointmentModal .appointment-type:has(input[value="Tätigkeit"]:checked) .type-icon{background:var(--flb-light-teal-soft, #1a5c57)!important;color:var(--flb-light-accent-ink, #52e2ce)!important}
 #appointmentModal label:has(#appointmentActivity),#appointmentModal .appointment-activity-field{grid-column:1/-1!important}
}


/* FL Buddy 7 – Fix 6: Samstag immer vollständig lesbar */
#liveCalendarGrid .day-head.weekend,
#liveCalendarGrid .day-head.weekend span,
#liveCalendarGrid .day-head.weekend strong,
#liveCalendarGrid .day-head.weekend small{
  opacity:1!important;
  filter:none!important;
  visibility:visible!important;
}

/* Fix 7 – konsolidiert auf dem tatsächlich deployten Repo-Stand */
@media (min-width:1101px){
 html body #page-kalender .week-calendar{scrollbar-width:none!important;-ms-overflow-style:none!important}
 html body #page-kalender .week-calendar::-webkit-scrollbar{display:none!important;width:0!important;height:0!important;background:transparent!important}
 html body #page-kalender .week-calendar::-webkit-scrollbar-thumb{display:none!important;background:transparent!important}
 #appointmentModal .appointment-modal-head{padding-top:12px!important}
}
#liveCalendarGrid .day-head.weekend{opacity:1!important;color:var(--flb-light-ink, #eefafa)!important;background:var(--flb-light-surface, #10343b)!important}
#liveCalendarGrid .day-head.weekend span,#liveCalendarGrid .day-head.weekend strong,#liveCalendarGrid .day-head.weekend small{opacity:1!important;color:inherit!important;filter:none!important}

/* Fix 63.4 – Theorie-Bearbeitung: stabile Spalten ohne Überlappung */
#theoryLiveBackdrop .theory-live-grid > label{min-width:0!important;align-content:start!important}
#theoryLiveBackdrop .theory-live-grid > label input,
#theoryLiveBackdrop .theory-live-grid > label select,
#theoryLiveBackdrop .theory-live-grid > label .custom-select,
#theoryLiveBackdrop .theory-live-grid > label .select-shell{width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important}
#theoryLiveBackdrop #theoryLiveName{width:100%!important;min-width:0!important;box-sizing:border-box!important}

/* The student record remains in its page DOM. The desktop detail column
   is reserved once, even when a secondary editor opens inside the record. */
@media (min-width:1101px) {
  body.flb7-workspace:has(:is(
    #page-fahrschueler .flb-student-record-host:not([hidden]) > #fullStudentRecordModal.show,
    #officeModal:not([hidden]),
    #flb127Drawer:not([hidden]),
    #flb7EntityDrawer:not([hidden]),
    #flbTheoryExam79:not([hidden]),
    #calendarAdkBackdrop:not([hidden]),
    #smartPlannerBackdrop:not([hidden]),
    #cancelledLessonActionModal:not([hidden]),
    #theoryQrBackdrop:not([hidden]),
    #adminEditorBackdrop:not([hidden]),
    #cancellationInboxModal:not([hidden]),
    #replacementFinderModal:not([hidden])
  )) .main-content {
    margin-right: calc(var(--flb-detail-width) + var(--flb-detail-gap)) !important;
    width: auto !important;
    min-width: 0 !important;
  }

  body.flb7-workspace :is(
    #officeModal, #flb127Drawer, #flb7EntityDrawer, #flbTheoryExam79,
    #calendarAdkBackdrop, #smartPlannerBackdrop, #cancelledLessonActionModal,
    #theoryQrBackdrop, #adminEditorBackdrop, #cancellationInboxModal, #replacementFinderModal
  ):not([hidden]) {
    position: fixed !important;
    inset: 100px 10px 10px auto !important;
    width: var(--flb-detail-width) !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: hidden !important;
    pointer-events: none !important;
    z-index: 190 !important;
  }

  body.flb7-workspace :is(
    #officeModal, #flb127Drawer, #flb7EntityDrawer, #flbTheoryExam79,
    #calendarAdkBackdrop, #smartPlannerBackdrop, #cancelledLessonActionModal,
    #theoryQrBackdrop, #adminEditorBackdrop, #cancellationInboxModal, #replacementFinderModal
  ):not([hidden]) > :first-child {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    transform: none !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    pointer-events: auto !important;
  }
}

@media (min-width:1101px) {
  /* Booking forms opened from another work panel sit above that panel. */
  body.flb7-workspace #appointmentModal.show,
  body.flb7-workspace #theoryLiveBackdrop:not([hidden]) {
    z-index: 205 !important;
  }

  body.flb7-workspace.flb7-record-open { white-space: normal; }
  body.flb7-workspace.admin-editor-open:has(#adminEditorBackdrop:not([hidden])) { overflow: auto; }

  body.flb7-workspace :is(#flb127Drawer, #flb7EntityDrawer, #officeModal):not([hidden]) > :first-child {
    border-radius: 16px;
  }
}

@media (min-width:1101px) {
  /* Keep the fixed record visible when its left-hand page is inactive. */
  body.flb7-workspace #page-fahrschueler:not(.active):has(> .flb-student-record-host:not([hidden]) > #fullStudentRecordModal.show) {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    animation: none !important;
  }
  body.flb7-workspace #page-fahrschueler:not(.active) > .flb-student-list-pane {
    display: none !important;
  }
}

#calendarTheoryDialog[hidden], #calendarTheoryError[hidden] { display:none !important; }
#calendarTheoryDialog .theory-live-modal { padding:18px 16px 14px; }
#calendarTheoryDialog .theory-live-modal > header { align-items:center; gap:12px; }
#calendarTheoryDialog .theory-live-modal h2 { font-size:21px; }
#calendarTheoryDialog .theory-live-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
#calendarTheoryDialog .theory-live-grid > label { min-width:0; }
@media (min-width:1101px) {
  #calendarTheoryDialog.show { top:calc(var(--demo-toolbar, 0px) + 112px) !important; z-index:205 !important; }
}
@media (max-width:1100px) {
  #calendarTheoryDialog.show {
    position:fixed; inset:calc(var(--demo-toolbar, 0px) + 8px) 8px 8px auto;
    width:min(480px,calc(100vw - 16px)); z-index:1000;
  }
  #calendarTheoryDialog .theory-live-modal { width:100%; max-height:100%; }
}

#oaOfficeFormPanel .oa-student-picker{display:block;position:relative;min-width:0;width:100%}
#oaOfficeFormPanel .oa-student-picker #oaStudentSearch{display:block;width:100%;min-width:0;box-sizing:border-box}
#oaOfficeFormPanel .oa-student-picker .oa-student-suggestions{display:block;position:absolute;top:calc(100% + 5px);left:0;right:0;width:100%;box-sizing:border-box;max-height:238px;overflow-y:auto;overflow-x:hidden;z-index:1000;padding:4px;background:var(--flb-light-surface, #102c35);border:1px solid var(--flb-light-outline, #487781);border-radius:10px;box-shadow:0 14px 32px rgba(0,0,0,.5)}
#oaOfficeFormPanel .oa-student-picker .oa-student-suggestions[hidden]{display:none!important}
#oaOfficeFormPanel .oa-form .oa-student-picker .oa-student-suggestions button{display:flex!important;flex-direction:row;align-items:center;justify-content:space-between;gap:10px;width:100%;max-width:100%;box-sizing:border-box;min-height:42px;margin:0!important;padding:9px 10px!important;border:0!important;border-radius:6px!important;background:transparent!important;color:var(--flb-light-ink, #eff9fa)!important;font:inherit;font-size:13px;text-align:left;cursor:pointer;box-shadow:none!important}
#oaOfficeFormPanel .oa-form .oa-student-picker .oa-student-suggestions button+button{border-top:1px solid var(--flb-light-line, #284953)!important}
#oaOfficeFormPanel .oa-form .oa-student-picker .oa-student-suggestions button:hover,#oaOfficeFormPanel .oa-form .oa-student-picker .oa-student-suggestions button.active{background:var(--flb-light-raised, #1b4d55)!important}
#oaOfficeFormPanel .oa-student-suggestions button span{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#oaOfficeFormPanel .oa-student-suggestions .oa-student-class{display:inline-block;flex-shrink:0;padding:3px 7px;border-radius:6px;background:var(--flb-light-raised, #244750);color:var(--flb-light-muted, #b9e2e1);font-size:11px;font-weight:700;white-space:nowrap}
#oaOfficeFormPanel .oa-student-empty{padding:12px;font-size:13px}
.flb-exam-registration[hidden] { display:none !important; }
#oaOfficeFormPanel .oa-form-panel,
.flb-exam-registration > .pp-modal-card {
  position: relative;
  padding: clamp(16px, 2vw, 26px);
  color: var(--flb-light-ink, #eff9fa);
  background: var(--flb-light-surface, #0b3037);
  border: 1px solid var(--flb-light-line, #365c65);
  border-radius: 16px;
  overflow: auto;
}
#oaOfficeFormPanel .oa-form h3 { margin: 0 42px 18px 0; }
#oaOfficeFormPanel .oa-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr));
  gap: 14px;
}
#oaOfficeFormPanel .oa-fields label { display:grid; gap:5px; min-width:0; align-content:start; }
#oaOfficeFormPanel .oa-fields label:last-child { grid-column:1 / -1; }
#oaOfficeFormPanel .oa-fields input:not([type="hidden"]),
#oaOfficeFormPanel .oa-fields select {
  width: 100%; min-width:0;
  padding: 9px 10px;
  border: 1px solid var(--flb-light-line, #365c65);
  border-radius: 8px;
  background: var(--flb-light-raised, #153b43);
  color: inherit;
}
#oaOfficeFormPanel .oa-form-close {
  position:absolute; top:14px; right:14px;
  border:1px solid var(--flb-light-line,#365c65);
  border-radius:8px;
  width:34px; height:34px;
  background:var(--flb-light-raised,#153b43); color:inherit;
  font-size:20px; cursor:pointer;
}
#oaOfficeFormPanel .oa-form-footer { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; margin-top:18px; }
#oaOfficeFormPanel #oaFormStatus { margin:14px 0 0; }
@media (min-width:1101px) {
  #oaOfficeFormPanel.show,
  .flb-exam-registration:not([hidden])[aria-hidden="false"] { z-index:205 !important; }
}
@media (max-width:1100px) {
  #oaOfficeFormPanel.show,
  .flb-exam-registration:not([hidden]) {
    position:fixed; inset:12px 8px 8px auto;
    display:block; width:min(520px,calc(100vw - 16px));
    padding:0; background:transparent; z-index:1000;
    pointer-events:none;
  }
  #oaOfficeFormPanel.show > *,
  .flb-exam-registration:not([hidden]) > * {
    width:100%; max-height:100%; margin:0; pointer-events:auto;
  }
}
#ppDemoRegistration .oa-form-footer {
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:10px;
  margin-top:16px;
}
