/* Compact controls in the application menus. Keep the login and print views separate. */
#app input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]),
#app select,
#modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]),
#modal select,
#outputDialog input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]),
#outputDialog select {
  height: 28px;
  min-height: 28px !important;
  padding-block: 2px;
}

#app textarea,
#modal textarea,
#outputDialog textarea {
  padding-block: 5px;
}

#app button,
#modal button,
#outputDialog button,
#appQuestion button,
#filePreviewDialog button {
  min-height: 24px !important;
  padding-block: 2px !important;
  line-height: 1.2;
}

/* The header previously assigned a fixed height to its filters and actions. */
main > header { --workspace-control-height: 28px; }
#app #toolbar > input,
#app #toolbar > select,
#app #toolbar > button,
#app #toolbar > label,
#app #toolbar > label > input:not([type="checkbox"]):not([type="radio"]),
#app #toolbar > label > select,
#app #actions > button {
  height: 28px;
  min-height: 28px !important;
  max-height: 28px;
}

#app > aside #menuToggle,
#app > aside.menu-open button[data-page],
#app > aside.menu-open #logout {
  min-height: 30px !important;
  padding-block: 3px !important;
}

/* Reduce the empty space around controls in all list rows. */
#content table th,
#content table td {
  padding-block: 8px;
}

/* A saved list row height takes precedence over the compact menu controls. */
#app #content.list-appearance-active table:not(.contract-layout-table):not(.contract-price-table):not(.contract-parties-table):not(.price-table) :is(input:not([type="checkbox"]), select, button),
#modal #modalBody.list-appearance-active table:not(.contract-layout-table):not(.contract-price-table):not(.contract-parties-table):not(.price-table) :is(input:not([type="checkbox"]), select, button) {
  height: max(24px, calc(var(--list-row-height) - 8px));
  min-height: 24px !important;
  font-size: var(--list-font-size);
}
#content table td.row-actions > button {
  margin-block: 1px;
}

/* Compact evaluation result rows without shrinking the document export. */
#content .evaluation-table th,
#content .evaluation-table td,
#content #evaluationPreview table th,
#content #evaluationPreview table td,
#content #reportResults table th,
#content #reportResults table td {
  padding-block: 1px !important;
  line-height: 1.05;
}
#content .evaluation-template-list {
  gap: 7px;
  padding: 10px;
}
#content .evaluation-template-list > section {
  padding: 6px 10px;
  gap: 8px;
}

/* Give the output dialog room for its settings and keep field selection usable. */
#outputDialog {
  height: min(760px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}
#outputDialog .output-field-picker[open] {
  flex: 1 1 320px;
}
#outputDialog .output-field-panel {
  position: static;
  width: 100%;
  max-width: 100%;
  margin-top: 6px;
  box-shadow: none;
}
#outputDialog #outputFieldChoices {
  max-height: min(400px, 45dvh);
}

/* Compact annual planner cards and separate student entry dialog. */
.annual-instructor-cell > span:not(.annual-cell-empty) {
  gap: 0;
  margin-block: 1px;
  padding: 2px 6px;
  line-height: 1.05;
  font-size: .86rem;
}
.annual-instructor-cell > span strong,
.annual-instructor-cell > span small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#toolbar .annual-instructor-picker {
  flex: 0 1 250px;
  min-width: 190px;
  max-width: 100%;
  border: 1px solid var(--input-border);
  background: var(--content-bg);
}
#toolbar .annual-instructor-picker > summary { padding: 4px 8px; }
#toolbar .annual-instructor-picker > div {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
}
#toolbar .annual-instructor-picker label { display: flex; align-items: center; gap: 7px; }
.annual-allocation-list { width: 100%; }
.annual-allocation-name {
  display: inline-block;
  padding: 2px 6px;
  background: var(--annual-named-color, #edf5f3);
  color: #000;
}
.annual-allocation-name.annual-name-open {
  background: var(--annual-open-color, #fff2a8);
}
.annual-allocation-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--input-border);
  background: var(--content-bg);
  color: var(--input-text);
}

/* List scrolling continues within the page. */
#content .table-scroll,
#content .sticky-list-scroll,
#content .annual-exam-wrap,
#content .customer-field-admin-scroll,
#content.sticky-list-scroll,
#content:has(> table) {
  overflow: auto;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
}
.annual-allocation-dialog header,
.annual-allocation-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.annual-allocation-dialog header { border-bottom: 1px solid var(--input-border); }
.annual-allocation-dialog header h3 { margin: 0; }
.annual-allocation-dialog footer { flex-wrap: wrap; border-top: 1px solid var(--input-border); }
.annual-allocation-fields { display: grid; gap: 12px; padding: 16px; }
.annual-allocation-fields label { display: grid; gap: 5px; }
.annual-allocation-fields input,
.annual-allocation-fields select { width: 100%; }
.reported-hours-dialog .annual-allocation-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reported-hours-dialog .annual-allocation-fields > .hint,
.reported-hours-dialog .annual-allocation-fields > .inline-check { grid-column: 1 / -1; }
@media (max-width: 520px) {
  .reported-hours-dialog .annual-allocation-fields { grid-template-columns: 1fr; }
}

/* Die gespeicherten Button-Werte haben Vorrang vor den kompakten Standardmaßen. */
#app button:not(.app-close-x),
#modal button:not(.app-close-x),
#outputDialog button:not(.app-close-x),
#appQuestion button:not(.app-close-x),
#filePreviewDialog button:not(.app-close-x) {
  min-height: var(--app-button-height, 34px) !important;
  font-family: var(--app-button-font-family, "Segoe UI", Arial, sans-serif) !important;
  font-size: var(--app-button-font-size, 15px) !important;
  font-weight: var(--app-button-font-weight, 700) !important;
}
#app #toolbar > button,
#app #actions > button {
  height: auto;
  max-height: none;
  min-height: var(--app-button-height, 34px) !important;
}
#app #content.list-appearance-active table:not(.contract-layout-table):not(.contract-price-table):not(.contract-parties-table):not(.price-table) button {
  height: auto;
  min-height: var(--app-button-height, 34px) !important;
}
#app > aside button[data-page],
#app > aside button[data-menu-heading],
#app > aside #logout,
#app > aside.menu-open button[data-page],
#app > aside.menu-open button[data-menu-heading],
#app > aside.menu-open #logout {
  width: var(--menu-button-width, 100%) !important;
  min-height: var(--menu-button-height, 41px) !important;
  font-family: var(--menu-button-font-family, "Segoe UI", Arial, sans-serif) !important;
  font-size: var(--menu-button-font-size, 15px) !important;
  font-weight: var(--menu-button-font-weight, 700) !important;
}
#app .menu-button-preview button {
  width: var(--menu-button-width, 100%) !important;
  min-height: var(--menu-button-height, 41px) !important;
  font-family: var(--menu-button-font-family, "Segoe UI", Arial, sans-serif) !important;
  font-size: var(--menu-button-font-size, 15px) !important;
  font-weight: var(--menu-button-font-weight, 700) !important;
}
/* Hauptmenü und Vorschau verwenden dieselbe zusätzliche Formatierung. */
#app > aside { gap: var(--menu-button-gap, 4px); }
#app > aside button[data-page],
#app > aside button[data-menu-heading],
#app > aside #logout,
#app .menu-button-preview button {
  font-style: var(--menu-button-font-style, normal) !important;
  letter-spacing: var(--menu-button-letter-spacing, 0px) !important;
  text-align: var(--menu-button-align, left) !important;
  border-radius: var(--menu-button-radius, 9px) !important;
  padding-inline: var(--menu-button-padding, 12px) !important;
}
#app .menu-button-preview { width: min(320px, 100%); }
#app .menu-button-preview button { background: transparent !important; color: #d9e8e4 !important; }
#app .menu-button-preview button.active { background: #ffffff !important; color: var(--sidebar) !important; }
:root[data-sidebar-button-colors] #app .menu-button-preview button {
  background-color: var(--sidebar-button-background) !important;
  color: var(--sidebar-button-text) !important;
  border: 1px solid var(--sidebar-button-border) !important;
}
:root[data-sidebar-button-colors] #app > aside button.active {
  background-color: var(--sidebar-button-activeBackground) !important;
  color: var(--sidebar-button-activeText) !important;
}

/* Dashboard shortcut has its own size and colors, including the active state. */
:root #app > aside .navigation-shortcuts :is(#dashboardToggle,#refreshPage) {
  width: 32px;
  height: 32px;
  min-height: 32px !important;
  flex: 0 0 32px;
  padding: 5px;
  border-radius: 0;
  background: var(--dashboard-button-background, #ffffff) !important;
  color: var(--dashboard-button-dots, #13352e) !important;
  border-color: var(--dashboard-button-background, #ffffff) !important;
}
#app :is(#dashboardToggle,#refreshPage) svg { width: 20px; height: 20px; }
:root[data-sidebar-button-colors] #app .menu-button-preview button.active {
  background-color: var(--sidebar-button-activeBackground) !important;
  color: var(--sidebar-button-activeText) !important;
}
#app button.app-close-x,
#modal button.app-close-x,
#outputDialog button.app-close-x {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  font-size: 22px !important;
}

/* Class fields share the compact customer label/control columns. */
#modalBody .customer-class-dialog .customer-data-field {
  display:block; width:100%; min-width:0;
  --customer-caption-width:min(11rem,35%); --customer-caption-gap:10px;
}
#modalBody .customer-class-dialog .customer-data-field > :is(label,.customer-multiselect-field) {
  display:grid; grid-template-columns:var(--customer-caption-width) minmax(0,1fr);
  align-items:center; gap:4px var(--customer-caption-gap); width:100%; min-width:0;
}
#modalBody .customer-class-dialog .customer-field-caption { grid-column:1; grid-row:1; min-width:0; }
#modalBody .customer-class-dialog .customer-data-field > label > :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea,.segmented-date),
#modalBody .customer-class-dialog .customer-multiselect-field > details {
  grid-column:2; grid-row:1; box-sizing:border-box; width:100%!important; max-width:100%; min-width:0;
}
#modalBody .customer-class-dialog .customer-data-field .review-settings {
  position:static; display:flex; align-items:center; justify-content:flex-start; flex-wrap:wrap;
  width:auto; min-width:0; gap:6px 12px;
  margin:6px 0 0 calc(var(--customer-caption-width) + var(--customer-caption-gap));
}
#modalBody .customer-class-dialog .review-settings[hidden],
#modalBody .customer-class-dialog .review-settings .review-date[hidden] { display:none; }
#modalBody .customer-class-dialog .review-settings .review-toggle {
  display:flex; flex-direction:row; align-items:center; gap:6px; width:auto; height:auto; flex:0 0 auto;
}
#modalBody .customer-class-dialog .review-settings .review-date {
  display:grid; grid-template-columns:auto minmax(0,190px); align-items:center; gap:8px;
  width:290px; max-width:100%; min-width:0; flex:0 1 290px; height:auto;
}
#modalBody .customer-class-dialog .review-date > .class-control-caption { grid-column:1; grid-row:1; }
#modalBody .customer-class-dialog .review-date > :is(input,.segmented-date) {
  grid-column:2; grid-row:1; width:100%; min-width:0; max-width:100%; box-sizing:border-box;
}
#modalBody .customer-class-dialog .segmented-date > input[type="text"] {
  box-sizing:border-box; flex:1 1 auto; width:0; min-width:0; padding-inline:8px;
}
#modalBody .customer-class-dialog .class-control-caption { margin:0; overflow-wrap:anywhere; }
@media(max-width:520px) {
  #modalBody .customer-class-dialog .review-settings .review-date { grid-template-columns:minmax(0,1fr); }
  #modalBody .customer-class-dialog .review-date > :is(input,.segmented-date) { grid-column:1; grid-row:2; }
}

/* Shared by the customer overview and its administrator preview. */
.customer-class-overview {
 background:var(--class-background,transparent); color:var(--class-text,inherit);
 border-color:var(--class-border,var(--input-border));
}
.customer-class-overview > h3 { color:var(--class-text,inherit); }
.customer-class-overview .hint { color:var(--class-text,inherit); }
.customer-class-overview .customer-classes-table { border-color:var(--class-border,var(--input-border)); }
.customer-class-overview .customer-classes-table th {
 background:var(--class-headerBackground,var(--table-header-bg,#e8eeee));
 color:var(--class-headerText,var(--class-text,inherit));
 border-color:var(--class-border,var(--input-border));
}
.customer-class-overview .customer-classes-table td {
 background:var(--class-rowBackground,transparent);color:var(--class-text,inherit);
 border-color:var(--class-border,var(--input-border));
}
.customer-class-overview .customer-classes-table tbody tr:nth-child(even) td { background:var(--class-alternateBackground,var(--class-rowBackground,transparent)); }
.customer-class-overview .customer-classes-table td.customer-class-overdue {
 background:var(--class-overdueBackground,#fbe3e1);color:var(--class-overdueText,#8b2424);
}

/* Keep the class overview within the same full-width grid area as customer fields. */
#modalBody > .customer-class-overview {
  grid-column:1 / -1;
  justify-self:start;
  box-sizing:border-box;
  width:100%;
  min-width:0;
  max-width:100%;
  margin-inline:0;
}
.customer-class-overview .customer-classes-table {
  width:100%;
  min-width:0;
  table-layout:fixed;
}
.customer-class-overview .customer-classes-table :is(th,td) {
  min-width:0;
  white-space:normal;
  overflow-wrap:anywhere;
}

.bonus-campaign-card { border:1px solid var(--input-border); padding:14px; margin-block:16px; min-width:0; }
.bonus-campaign-card h3 { margin:0; margin-right:auto; }
.bonus-campaign-card table,.bonus-registrations { width:100%; }
.bonus-registrations tbody tr { cursor:pointer; }
.bonus-editor { width:min(960px,calc(100vw - 32px)); max-height:90dvh; overflow:auto; padding:20px; background:var(--content-bg,#fff); color:var(--input-text,#17252b); border:1px solid var(--input-border); border-radius:0; }
.bonus-editor header,.bonus-editor footer { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.bonus-editor h2 { margin:0; }
.bonus-editor fieldset { border:0; padding:0; margin:16px 0; min-width:0; }
.bonus-editor-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.bonus-editor label { min-width:0; }
.bonus-editor :is(input,select) { width:100%; min-width:0; border-radius:0; }
.bonus-editor table { width:100%; }
.bonus-editor [data-bonus-error] { color:#a52020; white-space:pre-wrap; }
.bonus-editor dd { margin:0 0 14px; overflow-wrap:anywhere; }
.bonus-editor dt { font-weight:700; }
@media(max-width:640px) { .bonus-editor-fields { grid-template-columns:minmax(0,1fr); } }

.bonus-campaign-list { width:100%; }
.bonus-campaign-list tbody tr[data-bonus-campaign] { cursor:pointer; }
.bonus-editor footer { flex-wrap:wrap; }
.bonus-editor [data-registration-error] { color:#a52020; }

/* Date value, activation checkbox and deadline remain on one aligned row. */
#modalBody .customer-data-field.review-active-layout[data-customer-field] {
  display:grid; grid-template-columns:var(--customer-caption-width) minmax(0,1fr) auto;
  align-items:center; column-gap:var(--customer-caption-gap); row-gap:0;
}
#modalBody .customer-data-field.review-active-layout > label {
  display:contents!important;
}
#modalBody .customer-data-field.review-active-layout > label > .customer-field-caption {
  grid-column:1; grid-row:1; align-self:center;
}
#modalBody .customer-data-field.review-active-layout > label > :is(input,select,.segmented-date) {
  grid-column:2; grid-row:1; width:100%!important; min-width:0; margin:0;
}
#modalBody .customer-data-field.review-active-layout .review-settings {
  display:flex; position:static; grid-column:3; grid-row:1; flex-wrap:nowrap;
  align-items:center; justify-content:flex-start; width:auto; min-width:0;
  margin:0; gap:8px;
}
#modalBody .customer-data-field.review-active-layout .review-settings[hidden] { display:none; }
#modalBody .customer-data-field.review-active-layout .review-settings .review-toggle {
  display:flex; align-items:center; justify-content:center; flex:0 0 28px;
  width:28px; height:28px; min-width:0; padding:2px; margin:0;
}
#modalBody .customer-data-field.review-active-layout .review-settings .review-date {
  display:block; flex:0 0 12em; width:12em; max-width:none; min-width:0; height:auto; margin:0;
}
#modalBody .customer-data-field.review-active-layout .review-settings .review-date[hidden] { display:none; }
#modalBody .customer-data-field.review-active-layout .review-settings .class-control-caption { display:none; }
#modalBody .customer-data-field.review-active-layout .review-date > :is(input,.segmented-date) {
  width:100%; min-width:0; max-width:100%; margin:0;
}

/* Use the same caption and control columns as the customer-number row. */
#modalBody .customer-fixed-row > .customer-section-filter {
  display:grid; grid-template-columns:var(--customer-caption-width) minmax(0,1fr);
  align-items:center; column-gap:var(--customer-caption-gap); row-gap:4px;
  width:100%; min-width:0;
}
#modalBody .customer-fixed-row > .customer-section-filter > strong { grid-column:1; grid-row:1; min-width:0; }
#modalBody .customer-fixed-row > .customer-section-filter > details {
  grid-column:2; grid-row:1; width:100%; min-width:0; max-width:100%; margin:0; box-sizing:border-box;
}

/* Kundenbereiche direkt als nebeneinander angeordnete Checkboxen. */
#modalBody .customer-fixed-row > .customer-section-filter > .customer-section-checkboxes {
  grid-column:2;grid-row:1;display:flex;flex-wrap:wrap;align-items:center;
  gap:8px 20px;width:100%;min-width:0;box-sizing:border-box;
}
#modalBody .customer-section-checkboxes > label {
  display:inline-flex;flex-direction:row;align-items:center;justify-content:flex-start;
  gap:7px;margin:0;padding:0;width:auto;min-width:0;max-width:100%;
  flex:0 1 auto;overflow-wrap:anywhere;cursor:pointer;
}
#modalBody .customer-section-checkboxes > label > input[type="checkbox"] {
  width:16px;min-width:16px;height:16px;margin:0;flex:0 0 16px;
}
