/* Health & Infirmary (School ERP 3.2.80; laid out like Students in 3.2.82). Scoped to [data-gap-module="health"].
   Dialogs live on <body>, so they carry .hl-dialog; printed pages carry .hl-print.
   Every colour is an ERP token, which dark.css redefines — and inside a printed
   document the tokens are put back to paper, so the print rules use them too. */

[data-gap-module="health"] { display: grid; gap: 16px; }

/* The restriction line under the figures, and the fuller note in Overview. */
[data-gap-module="health"] .hl-restricted {
  margin: 0; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  border-radius: 12px; background: color-mix(in srgb, var(--danger) 7%, var(--surface)); color: var(--ink); font-size: 12px; line-height: 1.5;
}
[data-gap-module="health"] .hl-restricted strong { color: var(--danger); }
[data-gap-module="health"] .hl-notice {
  display: grid; gap: 4px; margin: 0 0 16px; padding: 12px 14px; border-left: 4px solid var(--danger);
  border-radius: 10px; background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}
[data-gap-module="health"] .hl-notice strong { color: var(--danger); font-size: 13px; }
[data-gap-module="health"] .hl-notice p { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.6; }

/* The pane strip, used only until the workspace builds its own drawer. */
[data-gap-module="health"] .hl-tabs,
.hl-dialog .hl-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
[data-gap-module="health"] .hl-tabs button,
.hl-dialog .hl-tabs button {
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
[data-gap-module="health"] .hl-tabs button:hover,
.hl-dialog .hl-tabs button:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
[data-gap-module="health"] .hl-tabs button.active,
.hl-dialog .hl-tabs button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
[data-gap-module="health"] .hl-tabs button:focus-visible,
.hl-dialog .hl-tabs button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 2px; }
[data-gap-module="health"] [data-hl-section][hidden] { display: none; }

/* Forms: the ERP form-grid, widened where a form has many short fields. */
[data-gap-module="health"] .hl-grid-3,
.hl-dialog .hl-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-gap-module="health"] .hl-grid-4,
.hl-dialog .hl-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
[data-gap-module="health"] .form-grid + .hl-subhead,
[data-gap-module="health"] div + form.form-grid,
[data-gap-module="health"] .data-table-wrap + form.form-grid { margin-top: 22px; }
[data-gap-module="health"] .hl-subhead,
.hl-dialog .hl-subhead { margin: 18px 0 10px; color: var(--ink); font-size: 14px; font-weight: 750; }
[data-gap-module="health"] .form-grid > .hl-subhead { margin: 0; }
[data-gap-module="health"] .inline-check,
.hl-dialog .inline-check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
[data-gap-module="health"] .inline-check input[type="checkbox"],
.hl-dialog .inline-check input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--brand); }
[data-gap-module="health"] [data-hl-when][hidden],
.hl-dialog [data-hl-when][hidden],
.hl-dialog [hidden] { display: none; }
[data-gap-module="health"] .hl-hint,
.hl-dialog .hl-hint { margin: 6px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
[data-gap-module="health"] .hl-empty,
.hl-dialog .hl-empty { margin: 8px 0; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; text-align: center; }
[data-gap-module="health"] .hl-warn,
.hl-dialog .hl-warn { color: var(--warning) !important; font-weight: 700; }
[data-gap-module="health"] .table-toolbar .hl-subhead { margin: 0; align-self: center; flex: 1; }
[data-gap-module="health"] .table-toolbar button { align-self: flex-end; }

/* The sentence a parent will read. */
[data-gap-module="health"] .hl-preview,
.hl-dialog .hl-preview {
  display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--brand-soft); color: var(--ink); font-size: 12px;
}
[data-gap-module="health"] .hl-preview span,
.hl-dialog .hl-preview span { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
[data-gap-module="health"] .hl-preview q,
.hl-dialog .hl-preview q { color: var(--ink); font-size: 13px; line-height: 1.5; }

/* Pills and alert lines. */
[data-gap-module="health"] .hl-pill,
.hl-dialog .hl-pill,
.hl-print .hl-pill {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap;
  color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, var(--surface));
}
.hl-pill--success { color: var(--success) !important; background: color-mix(in srgb, var(--success) 13%, var(--surface)) !important; }
.hl-pill--warning { color: var(--warning) !important; background: color-mix(in srgb, var(--warning) 15%, var(--surface)) !important; }
.hl-pill--danger { color: var(--danger) !important; background: color-mix(in srgb, var(--danger) 12%, var(--surface)) !important; }
[data-gap-module="health"] .hl-alert-line {
  display: block; margin: 2px 0; padding-left: 8px; border-left: 3px solid var(--danger); color: var(--ink); font-size: 11.5px; line-height: 1.4;
}
[data-gap-module="health"] .hl-alert-item,
.hl-print .hl-alert-item { margin: 0 0 6px; }
[data-gap-module="health"] .hl-alert-item small,
.hl-print .hl-alert-item small { display: block; }
[data-gap-module="health"] .hl-alert-class h4,
.hl-print .hl-alert-class h4 { margin: 16px 0 8px; font-size: 13px; color: var(--brand-ink); }
[data-gap-module="health"] .hl-pre,
.hl-dialog .hl-pre { white-space: pre-line; }

/* Overview cards. */
[data-gap-module="health"] .hl-overview { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; }
[data-gap-module="health"] .hl-toolbar { margin-top: 16px; }
[data-gap-module="health"] .hl-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
[data-gap-module="health"] .hl-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
[data-gap-module="health"] .hl-card h3 { margin: 0; font-size: 14px; }
[data-gap-module="health"] .hl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
[data-gap-module="health"] .hl-chip { padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 11px; font-weight: 750; }
[data-gap-module="health"] .hl-alert-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
[data-gap-module="health"] .hl-alert-list > li {
  display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; align-items: start; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--line); border-left: 4px solid var(--danger); border-radius: 10px; background: var(--canvas);
}
[data-gap-module="health"] .hl-alert-list > li small { display: block; color: var(--muted); font-size: 11px; }
[data-gap-module="health"] .hl-alert-list ul { margin: 0; padding-left: 16px; font-size: 12px; line-height: 1.45; color: var(--ink); }
[data-gap-module="health"] .hl-mini-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
[data-gap-module="health"] .hl-mini-list li { display: grid; grid-template-columns: 48px 1fr; gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
[data-gap-module="health"] .hl-mini-list li:last-child { border-bottom: 0; }
[data-gap-module="health"] .hl-mini-list b { color: var(--brand-ink); }
[data-gap-module="health"] .hl-mini-list small { color: var(--muted); }
[data-gap-module="health"] .hl-mini-list em { grid-column: 2; color: var(--muted); font-style: normal; font-size: 11px; }
[data-gap-module="health"] .hl-figure { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
[data-gap-module="health"] .hl-figure strong { color: var(--ink); font-size: 20px; }

/* The class sheet of a check-up camp. */
[data-gap-module="health"] .hl-sheet { margin-top: 14px; }
[data-gap-module="health"] .hl-sheet-head { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
[data-gap-module="health"] .hl-sheet-head strong { color: var(--ink); }
[data-gap-module="health"] .hl-sheet-table input,
[data-gap-module="health"] .hl-sheet-table select {
  width: 100%; min-width: 68px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px;
}
[data-gap-module="health"] .hl-sheet-table input:focus,
[data-gap-module="health"] .hl-sheet-table select:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
[data-gap-module="health"] .hl-sheet-table output { font-weight: 800; color: var(--brand-ink); }
[data-gap-module="health"] .hl-sheet .form-actions { margin-top: 12px; }

/* Registers (3.2.82): laid out as the Students register — the filter row and the
   register's own search row above, the register below. The filter rows hold
   dates, the person picker and Print buttons besides selects. */
[data-gap-module="health"] .register-filter input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]) {
  max-width: 100%; min-height: 36px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 650;
}
[data-gap-module="health"] .register-filter .hl-print-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; align-self: end; }
[data-gap-module="health"] .register-filter .hl-print-actions[hidden] { display: none; }
[data-gap-module="health"] .register-search .btn[hidden],
[data-gap-module="health"] .register-filter .btn[hidden] { display: none; }
[data-gap-module="health"] .register-filter + .register-filter { border-top: 0; }

[data-gap-module="health"] .register-subhead.hl-camp-load { margin: 22px 0 8px; }
[data-gap-module="health"] .register-subhead.hl-toolbar { margin: 18px 0 4px; }

/* Repeatable rows: the medicines of a visit, the doses of a batch, the doctors of a camp. */
[data-gap-module="health"] .hl-rep,
.hl-dialog .hl-rep { display: grid; gap: 10px; min-width: 0; }
[data-gap-module="health"] .hl-rep-title,
.hl-dialog .hl-rep-title { color: var(--ink); font-size: 13px; font-weight: 750; }
[data-gap-module="health"] [data-hl-rep-rows],
.hl-dialog [data-hl-rep-rows] { display: grid; gap: 10px; }
[data-gap-module="health"] .hl-rep-row,
.hl-dialog .hl-rep-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; min-width: 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-sunken, var(--canvas));
}
[data-gap-module="health"] .hl-rep-row > label,
.hl-dialog .hl-rep-row > label { flex: 1 1 170px; min-width: 0; }
[data-gap-module="health"] .hl-rep-row > label:first-child,
.hl-dialog .hl-rep-row > label:first-child { flex-grow: 2; }
[data-gap-module="health"] .hl-rep-actions,
.hl-dialog .hl-rep-actions { flex: 0 0 auto; }
[data-gap-module="health"] .hl-rep-note,
.hl-dialog .hl-rep-note { flex: 1 1 100%; color: var(--muted); font-size: 11.5px; font-weight: 600; }
[data-gap-module="health"] .hl-rep-note:empty,
.hl-dialog .hl-rep-note:empty { display: none; }
[data-gap-module="health"] .hl-rep > .btn,
.hl-dialog .hl-rep > .btn { justify-self: start; }
[data-gap-module="health"] .hl-parent-box { display: grid; gap: 10px; }

/* The profile dialog. */
.hl-dialog .hl-dialog-body { display: grid; gap: 12px; padding: 0 20px 20px; }
.hl-dialog .hl-profile-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas);
}
.hl-dialog .hl-profile-head > div:first-child { display: grid; gap: 3px; }
.hl-dialog .hl-profile-head strong { color: var(--ink); font-size: 16px; }
.hl-dialog .hl-profile-head span { color: var(--muted); font-size: 12px; }
.hl-dialog .hl-profile-facts { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.hl-dialog .hl-profile-facts b { color: var(--danger); font-size: 15px; }
.hl-dialog .hl-profile-alerts {
  margin: 0; padding: 10px 14px 10px 30px; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface)); color: var(--ink); font-size: 12.5px; font-weight: 650; line-height: 1.55;
}
.hl-dialog .hl-profile-pane { display: grid; gap: 14px; }
.hl-dialog .hl-output { display: block; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--brand-ink); font-weight: 800; min-height: 40px; }

/* Printed pages: one letterhead per page, plain ruled tables, paper tokens. */
.hl-print-page { break-after: page; page-break-after: always; }
.hl-print-page:last-child { break-after: auto; page-break-after: auto; }
.hl-print { display: grid; gap: 8px; font-size: 10.5pt; color: var(--ink); }
.hl-print h3 { margin: 10px 0 4px; font-size: 11.5pt; color: var(--brand-ink); }
.hl-print p { margin: 0 0 4px; line-height: 1.5; }
.hl-print-note { color: var(--muted); font-size: 9pt; font-style: italic; }
/* The ERP gives every table a 760px floor for the screen; on A4 a table fits the page. */
.hl-print table,
.hl-print-table { width: 100%; min-width: 0 !important; max-width: 100%; table-layout: auto; border-collapse: collapse; margin: 4px 0 10px; font-size: 9.5pt; }
.hl-print-table th,
.hl-print-table td { padding: 5px 6px; border: 1px solid var(--line); text-align: left; vertical-align: top; font-size: inherit; white-space: normal; overflow-wrap: anywhere; }
.hl-print-table th { background: var(--surface-sunken, var(--canvas)); color: var(--ink); font-weight: 750; text-transform: none; letter-spacing: 0; }
.hl-print-table small { display: block; color: var(--muted); font-size: 8.5pt; }
.hl-print-table tr { break-inside: avoid; page-break-inside: avoid; }
.hl-print-card th { width: 34%; }
.hl-print-tally td { text-align: center; font-weight: 750; }
.hl-print .hl-alert-class { break-inside: auto; }

@media (max-width: 1100px) {
  [data-gap-module="health"] .hl-overview { grid-template-columns: 1fr; }
  [data-gap-module="health"] .hl-grid-4,
  .hl-dialog .hl-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  [data-gap-module="health"] .hl-grid-3,
  [data-gap-module="health"] .hl-grid-4,
  .hl-dialog .hl-grid-3,
  .hl-dialog .hl-grid-4 { grid-template-columns: 1fr; }
  [data-gap-module="health"] .hl-alert-list > li { grid-template-columns: 1fr; }
  .hl-dialog .hl-dialog-body { padding: 0 12px 14px; }
}
@media print {
  .hl-print-page { break-after: page; }
}
