/* Add-data forms, the toast and the allergy dialog. Loaded after chart.css. Only the page scrolls. */

.ehr-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 12px; }
.ehr-title-row h1 { margin: 0; }
.ehr-sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 10px; }
.ehr-sec-head h2.ehr-section-label { margin: 0; }
button.ehr-action { cursor: pointer; }

.ehr-hint { margin: 0 0 16px; color: var(--ehr-muted); max-width: 46rem; }

main form.ehr-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; align-items: start; max-width: 860px; margin: 0; }
.ehr-form .ehr-field { gap: 6px; }
.ehr-form .ehr-field-wide, .ehr-form .ehr-form-actions { grid-column: 1 / -1; }
.ehr-form .ehr-field input, .ehr-form .ehr-field select, .ehr-form .ehr-field textarea { width: 100%; min-width: 0; }
.ehr-form-actions { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }

input[type="date"], input[type="number"], select, textarea {
  font: 16px/1.3 var(--ehr-font);
  color: var(--ehr-ink);
  background: #fff;
  border: 1px solid var(--ehr-line-strong);
  border-radius: var(--ehr-radius);
  padding: 8px 12px;
  margin: 0;
}
textarea { resize: vertical; }
input[type="date"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  outline: 2px solid var(--ehr-focus);
  outline-offset: 1px;
  border-color: var(--ehr-focus);
}

.ehr-error { color: var(--ehr-allergy-ink); font-size: 13px; font-weight: 500; }
.ehr-error:empty { display: none; }
.ehr-form-errors { background: var(--ehr-allergy-bg); color: var(--ehr-allergy-ink); border: 1px solid #e3bcbc; border-radius: var(--ehr-radius); padding: 10px 14px; margin: 0 0 16px; max-width: 860px; }
.ehr-form-errors ul { margin: 6px 0 0; padding-left: 20px; }

.ehr-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 14px;
  max-width: min(560px, calc(100vw - 24px));
  background: #1c4a2e; color: #fff; border-radius: var(--ehr-radius);
  padding: 12px 16px; box-shadow: 0 4px 16px rgba(26, 31, 41, 0.28);
  font-size: 15px; font-weight: 500;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.ehr-toast.is-hidden { opacity: 0; visibility: hidden; }
.ehr-toast-close { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.6); border-radius: var(--ehr-radius); font: 600 13px/1 var(--ehr-font); padding: 6px 10px; min-height: 32px; cursor: pointer; }
.ehr-toast-close:hover { background: rgba(255, 255, 255, 0.16); }
.ehr-toast-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

dialog.ehr-dialog { border: 1px solid var(--ehr-line-strong); border-radius: var(--ehr-radius); padding: 20px; width: min(520px, calc(100vw - 24px)); max-height: none; overflow: visible; color: var(--ehr-ink); box-shadow: 0 8px 32px rgba(26, 31, 41, 0.3); }
dialog.ehr-dialog::backdrop { background: rgba(26, 31, 41, 0.45); }
dialog.ehr-dialog h2 { margin: 0 0 6px; font-size: 18px; }
main form.ehr-form-dialog { display: flex; flex-direction: column; align-items: stretch; gap: 14px; max-width: none; }

@media (max-width: 800px) {
  .ehr-title-row .ehr-action, .ehr-sec-head .ehr-action { min-height: 40px; }
  .ehr-form-actions .ehr-action { min-height: 40px; }
  .ehr-toast { bottom: 12px; }
}
