/* History rows: Completed Today, Handled Today, Escalated still open (W2-E). */

.hist-row { font-size: 0.85rem; padding: 7px 0; border-bottom: 1px solid #f0f0f0; overflow-wrap: anywhere; }
.hist-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
/* P3.2614: the URGENT label on an urgent item's row sits on the line, not above it. */
.hist-line .urgent-label { margin-bottom: 0; flex: none; }
.hist-time { color: #666; font-variant-numeric: tabular-nums; }
.hist-patient { font-weight: 600; }
.hist-subject { color: #333; }
.hist-status { font-weight: 700; }
/* P1.2191: a rejection is red by class, never by inline style. */
.hist-rejected { color: #c0392b; }
.hist-approved, .hist-handled { color: #1e8449; }
.hist-escalated { color: #b9770e; }
/* R.158 Q9: a refill closed in athena (nothing sent from P17). */
.hist-done-athena { color: #1a5276; }
.hist-other { color: #2e86c1; }
.hist-send { font-size: 0.75rem; padding: 1px 7px; border-radius: 10px; border: 1px solid currentColor; }
.hist-send-yes { color: #1a5276; }
.hist-send-no { color: #6e2c00; }
.hist-who { color: #555; }
.hist-id { font-family: monospace; font-size: 0.8rem; color: #777; }
.hist-reason { margin-top: 3px; color: #555; }
.hist-reason-label { font-weight: 600; color: #c0392b; }
.hist-staff-note { margin-top: 3px; color: #555; }
/* P3.4858 (R.206 Q22): the inbox message closed together with a refill. */
.hist-closed-twin { margin-top: 3px; color: #666; font-size: 0.85rem; }
/* P3.2858: the sent text holds "\n\nNote from Dr. Tirmal:\nnote"; keep its lines as the preview showed them. */
.hist-reason-text, .hist-staff-note-text { white-space: pre-line; }
/* P3.2862 row 2: the row buttons keep one place, first Reopen, then Mark Handled. */
.hist-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; flex: 0 1 auto; min-width: 0; max-width: 100%; }
/* P3.3113 row 1: text and chips in one block, the buttons beside it, so Reopen keeps one x whatever the row text length. */
.hist-split { flex-wrap: nowrap; align-items: flex-start; }
.hist-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; flex: 1 1 0; min-width: 0; }
.hist-split > .hist-actions { flex: none; margin-left: 0; }
.hist-actions .btn { max-width: 100%; white-space: normal; }
.hist-staff-note-label { font-weight: 600; color: #7d6608; }
.hist-row .btn-done-athena { background: #5d6d7e; color: white; }

/* P3.2202 (round 2): Reopen on Escalated / no-send Handled rows, with an
   in-row confirm (same look as the inbox card confirm). Classes only. */
.btn-reopen { background: #eaf2f8; color: #1a5276; border: 1px solid #a9cce3; padding: 4px 12px; }
.hist-confirm { margin-top: 6px; padding: 8px 12px; border: 1px solid #aab7b8; border-radius: 6px; background: #fbfcfc; }
.hist-confirm-text { font-weight: 600; margin-bottom: 6px; }
.hist-confirm-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.hist-confirm .btn-reopen-confirm { background: #1a5276; color: white; }
.hist-confirm .btn-cancel { background: #d5dbdb; color: #2c3e50; }
@media (max-width: 600px) {
  .hist-split { flex-direction: column; align-items: stretch; }
  .hist-split > .hist-actions { flex: none; max-width: 100%; }
  .btn-reopen { padding: 8px 14px; }
  .hist-confirm-buttons .btn { flex: 1 1 120px; padding: 10px 12px; }
}
