/* PatientNotes — internal org-only patient notes: add area + expand-in-place list.
   Uses the app's shadcn design tokens to stay consistent in light/dark. Shared by the
   receptionist workspace modal and the practitioner chart (see PatientNotes.tsx). */

.ahr-patient-notes {
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: hsl(var(--foreground));
}

/* Privacy disclaimer — read-only notice at the top of the notes view. */
.ahr-patient-notes__disclaimer {
  margin: 0;
  font-size: 13px;
  font-style: italic;
  line-height: 1.4;
  color: var(--ink-muted);
}

/* Add area (top) */
.ahr-patient-notes__add {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid hsl(var(--border));
}

.ahr-patient-notes__textarea {
  min-height: 84px;
  resize: vertical;
}

.ahr-patient-notes__add-actions,
.ahr-patient-notes__edit-actions {
  display: flex;
  justify-content: flex-end;
}

/* The autosave status sits to the LEFT of Save, on the same line, so the two are read together: what
   the draft is doing and what the button will do. `space-between` rather than pushing it, so an empty
   status leaves the button exactly where it was. */
.ahr-patient-notes__add-actions {
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ahr-patient-notes__draft-status {
  font-size: 12px;
  min-width: 0;
}

/* What the save is still waiting for. The same size as the draft status beside it, because the two
   are peers - one says what happened, the other says what is missing - and a token from the muted
   step of the ink scale rather than a colour, since this is an instruction and not a warning. */
.ahr-patient-notes__still-needed {
  font-size: 12px;
  min-width: 0;
  color: hsl(var(--muted-foreground));
}

/* List */
.ahr-patient-notes__list {
  display: flex;
  flex-direction: column;
}

.ahr-patient-notes__loading {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ahr-patient-notes__error {
  padding: 24px 0;
  text-align: center;
  font-size: 14px;
  color: hsl(var(--destructive));
}

.ahr-patient-notes__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 0;
  text-align: center;
  font-size: 14px;
  color: hsl(var(--muted-foreground));
}

/* Each note */
.ahr-patient-notes__item {
  border: 1px solid hsl(var(--border));
  border-radius: var(--ak-card-radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.ahr-patient-notes__item:last-child {
  margin-bottom: 0;
}

/* Clickable note row: click toggles show/hide of the full body. */
.ahr-patient-notes__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  cursor: pointer;
  outline: none;
}

.ahr-patient-notes__row:hover,
.ahr-patient-notes__row:focus-visible {
  background: hsl(var(--accent));
}

/* Note body — clamped to one line when hidden, full (wrapping) when shown. */
.ahr-patient-notes__body {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: hsl(var(--foreground));
}

.ahr-patient-notes__body--clamped {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ahr-patient-notes__body--full {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Author name + date/time. */
.ahr-patient-notes__meta {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

.ahr-patient-notes__visibility {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

/* Author edit/delete icons, shown below a note when it's expanded. */
.ahr-patient-notes__author-actions {
  display: flex;
  gap: 4px;
  padding: 0 10px 10px;
}

.ahr-patient-notes__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.ahr-patient-notes__icon-btn:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

/* Red delete icon — !important overrides the id-scoped global button color reset. */
.ahr-patient-notes__icon-btn--danger {
  color: var(--danger) !important;
}

.ahr-patient-notes__icon-btn--danger:hover {
  background: hsl(var(--muted));
}

.ahr-patient-notes__edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

/* The front desk's Quick View, from the receptionist deck's .rx-notes: a small Add note control,
   labelled fields, the audience or what is missing beside Save note, and notes as the shared list card
   (.ahr-list-card in index.css), which owns their geometry, lift and gap. */
#akashic-health-records-patient-portal-root .ahr-patient-notes--desk {
  gap: 10px;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__disclaimer {
  color: var(--ink-muted);
  font-size: 12px;
  font-style: normal;
  line-height: 18px;
}

/* Add note is the shared small ghost button, its chevron the shared .ak-chev after the label. */
#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .btn.ahr-patient-notes__toggle {
  align-self: flex-start;
  width: auto;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__add {
  gap: 14px;
  margin: 2px 0 6px;
  padding-bottom: 0;
  border-bottom: 0;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* An empty status would hold a gap before the line beside Save note. */
#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__draft-status:empty {
  display: none;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__draft-status,
#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__still-needed {
  margin: 8px 0;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 18px;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .btn.btn-green-sm {
  flex: none;
  margin-left: auto;
}

/* The failure and the saved line are the shared notices (.ak-notice--error, --success). */
#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__alert svg {
  flex: none;
  margin-top: 1px;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__alert p {
  margin: 3px 0 0;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__alert p.ahr-patient-notes__alert-title {
  margin: 0;
  color: var(--danger);
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk p.ahr-patient-notes__saved {
  margin: 0;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__item {
  margin: 0;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__row,
#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__edit {
  gap: 5px;
  padding: 0;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__author-actions {
  padding: 6px 0 0;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__body {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  font-weight: var(--ak-body-weight);
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__meta {
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 18px;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__history > .ahr-list-stack {
  margin-top: 8px;
}

#akashic-health-records-patient-portal-root .ahr-patient-notes--desk .ahr-patient-notes__history > summary {
  margin-top: 10px;
  font-size: 13px;
  cursor: pointer;
}
