/* Czytelniejsze formularze OSK i krótsze wpisy w kalendarzu. */

/* Formularz kursanta: równe kolumny, krótsze etykiety i kompaktowy wybór kategorii. */
#recordModal.student-form-modal .dialog {
  width: min(760px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
}
#recordModal.student-form-modal .dialog > .sub { margin-bottom: 14px; }
#recordModal.student-form-modal #recordFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
#recordModal.student-form-modal #recordFields > label {
  min-width: 0;
  margin: 0;
  color: #53677c;
  font-size: 12px;
  font-weight: 600;
}
#recordModal.student-form-modal #recordFields > .full,
#recordModal.student-form-modal #recordFields > .category-picker {
  grid-column: 1 / -1;
}
#recordModal.student-form-modal #recordFields .course-select-field.full { grid-column: auto; }
#recordModal.student-form-modal #recordFields input:not([type="checkbox"]),
#recordModal.student-form-modal #recordFields select,
#recordModal.student-form-modal #recordFields textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
#recordModal.student-form-modal #recordFields input:focus,
#recordModal.student-form-modal #recordFields select:focus,
#recordModal.student-form-modal #recordFields textarea:focus {
  border-color: var(--green);
  outline: 3px solid color-mix(in srgb, var(--green) 15%, transparent);
}
#recordModal.student-form-modal .category-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
#recordModal.student-form-modal .category-picker legend {
  margin-bottom: 7px;
  color: #53677c;
  font-size: 12px;
  font-weight: 600;
}
#recordModal.student-form-modal .category-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
#recordModal.student-form-modal .category-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  min-width: 68px;
  min-height: 38px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#recordModal.student-form-modal .category-choice:has(input:checked) {
  border-color: var(--green);
  background: var(--pale);
  color: var(--green);
}
#recordModal.student-form-modal .category-choice input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--green);
}
#recordModal.student-form-modal #recordFields > label.check-field.full {
  grid-column: auto;
  min-height: 38px;
  align-self: center;
}
#recordModal.student-form-modal .student-payment-profile {
  grid-column: 1 / -1;
}
#recordModal.student-form-modal .dialog .actions {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  margin-top: 6px;
  padding: 12px 0 0;
  background: #fff;
}

/* Wpłaty: osobny, kompaktny formularz i podsumowanie przed zapisem. */
#manualPaymentPanel {
  max-width: 820px;
  margin: 16px 20px;
  padding: 20px;
  border-color: var(--line);
}
#manualPaymentPanel > h2 { margin: 0 0 15px; color: var(--ink); font-size: 19px; }
#manualPaymentForm .formgrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
#manualPaymentForm .formgrid > label {
  min-width: 0;
  margin: 0;
  color: #53677c;
  font-size: 12px;
  font-weight: 600;
}
#manualPaymentForm input:not([type="checkbox"]),
#manualPaymentForm select {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
#manualPaymentForm input:focus,
#manualPaymentForm select:focus {
  border-color: var(--green);
  outline: 3px solid color-mix(in srgb, var(--green) 15%, transparent);
}
#manualPaymentForm .student-picker { margin-top: 0; }
#manualPaymentForm .student-picker-input {
  min-height: 43px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}
#manualPaymentForm .student-picker-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent);
}
#manualPaymentSummary.payment-balance-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 15px 0 4px;
}
#manualPaymentSummary.payment-balance-grid p {
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--pale);
}
#manualPaymentSummary.payment-balance-grid span {
  margin-bottom: 4px;
  color: #53677c;
  font-size: 11px;
}
#manualPaymentSummary.payment-balance-grid strong {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
#manualPaymentForm > .actions {
  justify-content: flex-end;
  margin-top: 14px;
}
#manualPaymentForm > .actions .primary { min-width: 150px; }

/* Kalendarz: nazwisko, przedział czasu, godziny, rejestracja i typ jazdy. */
#grid .lesson:not(.blocked-time) {
  padding: 5px 6px;
  border-radius: 7px;
  line-height: 1.25;
}
#grid .lesson:not(.blocked-time) > strong {
  margin: 0 0 3px;
  padding: 0;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
#grid .lesson:not(.blocked-time) > small.lesson-meta-line,
#grid .lesson.group-lesson .group-lesson-student > .lesson-meta-line,
#grid .lesson.group-lesson .group-lesson-open > span {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 5px;
  font-size: 9px;
  line-height: 1.25;
  opacity: 1;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
#grid .lesson.group-lesson > strong { margin-bottom: 3px; }
#grid .lesson.group-lesson .group-lesson-participants {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
#grid .lesson.group-lesson .group-lesson-student,
#grid .lesson.group-lesson .group-lesson-open {
  display: block;
  margin: 0;
  font-size: 9px;
  line-height: 1.25;
}
#grid .lesson.group-lesson .group-lesson-student > b,
#grid .lesson.group-lesson .group-lesson-open > b {
  display: block;
  margin-bottom: 1px;
  font-size: 9px;
  font-weight: 750;
  opacity: 1;
}
#grid .lesson.group-lesson .group-lesson-student > .lesson-meta-line,
#grid .lesson.group-lesson .group-lesson-open > span { opacity: 1; }
#grid .lesson.lesson-additional .lesson-kind-tag {
  color: #8f4b0d;
  font-weight: 750;
}
#grid .lesson.editable-lesson:hover,
#grid .lesson.editable-lesson:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

@media (max-width: 700px) {
  #recordModal.student-form-modal .dialog { padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
  #recordModal.student-form-modal #recordFields,
  #manualPaymentForm .formgrid { grid-template-columns: minmax(0, 1fr); }
  #recordModal.student-form-modal #recordFields > .full,
  #recordModal.student-form-modal #recordFields > .category-picker,
  #recordModal.student-form-modal #recordFields > label.check-field.full,
  #recordModal.student-form-modal .course-select-field.full { grid-column: auto; }
  #recordModal.student-form-modal .dialog .actions { margin-right: -2px; margin-left: -2px; }
  #manualPaymentPanel { max-width: none; margin: 12px; padding: 16px; }
  #manualPaymentSummary.payment-balance-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  #manualPaymentSummary.payment-balance-grid p { display:flex; align-items:center; justify-content:space-between; gap:12px; }
  #manualPaymentSummary.payment-balance-grid span { margin:0; }
  #manualPaymentSummary.payment-balance-grid strong { text-align:right; }
  #manualPaymentForm > .actions .primary { width:100%; min-height:44px; }
  #grid .lesson:not(.blocked-time) { padding: 4px; }
  #grid .lesson:not(.blocked-time) > strong { font-size: 9px; }
  #grid .lesson:not(.blocked-time) > small.lesson-meta-line,
  #grid .lesson.group-lesson .group-lesson-student > .lesson-meta-line,
  #grid .lesson.group-lesson .group-lesson-open > span { font-size: 8px; gap: 1px 3px; }
}
