/* Shared entry-form presentation. Keep these rules out of printed reports. */
@media screen {
  .main-content form .form-label,
  .main-content form .field-group > label,
  .main-content form .form-field > label {
    display: block;
    margin-bottom: 9px;
    font-size: 15px;
    font-weight: 700;
    color: #172f45;
  }
  .main-content form .form-control,
  .main-content form .form-select {
    min-height: 48px;
    max-width: 100%;
    box-sizing: border-box;
    border-color: #9aafc1;
    color: #142b3d;
    font-size: 15px;
  }
  .main-content form .form-control:focus,
  .main-content form .form-select:focus {
    border-color: #4985b1;
    box-shadow: 0 0 0 3px #4985b126;
  }
  .main-content form .is-invalid { border-color: #c94d5d; }
  .main-content form .form-text,
  .main-content form .form-section-description { color: #344b60; line-height: 1.6; }
  .main-content form .form-field { min-width: 0; }
  .main-content form .password-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .main-content form .password-tools .btn { min-height: 36px; }
  .main-content .editor-panel {
    width: 100%; max-width: 1120px; min-width: 0; overflow-x: auto;
  }
  .main-content .editor-panel > form { min-width: 0; }
  .main-content .editor-panel > form:has(> .form-sections),
  .main-content .editor-panel > form:has(> .document-sections),
  .main-content .editor-panel > form:has(> .form-grid) { min-width: 860px; }
  .main-content .editor-panel > form > .form-sections {
    display: grid; gap: 22px; padding: 28px;
  }
  .main-content .editor-panel .form-section {
    min-width: 0; padding: 22px; margin: 0;
    border: 1px solid #bccbd9; border-radius: 12px; background: #fff;
  }
  .main-content .editor-panel .form-section legend {
    float: none; width: auto; max-width: 100%; padding: 0 8px;
    margin-bottom: 10px; font-size: 18px; font-weight: 700; color: #172f45;
  }
  .main-content .editor-panel .form-section-description { margin-bottom: 18px; font-size: 14px; }
  .main-content :is(.editor-panel,.student-entry) .form-fields-grid,
  .main-content :is(.editor-panel,.student-entry) .form-grid:not(:has(.form-sections)):not(:has(.form-fields-grid)),
  .main-content form .salary-form-grid,
  .main-content form.pay-head-form,
  .main-content form .loan-form-grid,
  .main-content form .accounting-form-grid {
    display: grid; grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 22px; align-items: start; min-width: 780px;
  }
  .main-content .editor-panel .exam-schedule-four,
  .main-content .student-entry .assignment-section .form-grid {
    grid-template-columns: repeat(4,minmax(0,1fr));
  }
  .main-content .editor-panel form .form-fields-grid,
  .main-content .editor-panel form .form-grid { min-width: 0; }
  .main-content .salary-form-card,
  .main-content .pay-head-card,
  .main-content .loan-card,
  .main-content .student-entry-section,
  .main-content .student-entry .family-section,
  .main-content .content-card:has(.accounting-form-grid) {
    min-width: 0; overflow-x: auto;
  }
  .main-content form .field-wide,
  .main-content form .full-width { grid-column: 1 / -1; }
  .main-content form .form-actions { flex-wrap: wrap; }
  .main-content form .form-actions-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
  .main-content form .field-errors p { color: #b02f43; }
}
/* Zoom on desktop preserves columns; small touch screens reflow for typing. */
@media screen and (pointer:coarse) and (max-width:650px) {
  .main-content .editor-panel > form,
  .main-content .editor-panel > form:has(> .form-sections),
  .main-content .editor-panel > form:has(> .document-sections),
  .main-content .editor-panel > form:has(> .form-grid) { min-width: 0; }
  .main-content .editor-panel > form > .form-sections { padding: 18px; }
  .main-content .editor-panel .form-section { padding: 16px; }
  .main-content :is(.editor-panel,.student-entry) .form-fields-grid,
  .main-content :is(.editor-panel,.student-entry) .form-grid:not(:has(.form-sections)):not(:has(.form-fields-grid)),
  .main-content form .salary-form-grid,
  .main-content form.pay-head-form,
  .main-content form .loan-form-grid,
  .main-content form .accounting-form-grid,
  .main-content .editor-panel .exam-schedule-four,
  .main-content .student-entry .assignment-section .form-grid {
    min-width: 0; grid-template-columns: 1fr;
  }
  .main-content form .pay-head-submit { grid-column: 1 / -1; }
}

@media screen {
  .main-content .fee-matrix-editor { width:100%; max-width:none; min-width:0; padding:24px; overflow:visible; }
  .main-content .fee-matrix-editor > form { min-width: 0; }
  .main-content .fee-year-controls { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; max-width:640px; }
  .main-content .fee-year-controls select { width:100%; min-width:0; }
  .main-content .fee-matrix-wrap,.main-content .student-fee-grid-wrap { width:100%; min-width:0; }
  .main-content .fee-matrix input { width:130px; max-width:100%; }
}

@media screen and (max-width:600px) {
  .main-content .fee-matrix-editor { padding:18px; }
  .main-content .fee-year-controls { grid-template-columns:minmax(0,1fr); }
  .main-content .fee-year-controls button { justify-self:start; }
}
