textarea {
  width: 100%; padding: 13px 14px; border: 1px solid #dfe1e6;
  border-radius: 12px; background: #fff; resize: vertical; outline: none;
  font: inherit;
}
.wide { grid-column: 1 / -1; }
.patient-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.patient-card {
  background: #fff; border: 1px solid var(--line); border-radius: 19px; padding: 22px;
}
.patient-top { display: flex; justify-content: space-between; gap: 14px; }
.patient-card h3 { margin: 0 0 6px; font-size: 18px; }
.patient-card .phone { color: var(--muted); font-size: 13px; }
.case-summary {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  display: grid; gap: 7px; font-size: 13px;
}
.case-summary span { color: var(--muted); }
.patient-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.patient-actions button { width: auto; padding: 9px 12px; }
.case-details { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.case-details h4 { margin: 0 0 10px; }
.case-details p { margin: 8px 0; }
.case-details span { color: var(--muted); }
.checkin-answer { padding: 14px 0; border-top: 1px solid var(--line); }
.checkin-answer p { margin: 6px 0; line-height: 1.5; }
.checkin-alert { color: var(--danger); }
.chat-inbox-row { display:flex; justify-content:space-between; align-items:center; gap:10px; width:100%; text-align:left; padding:14px 0; background:none; border:0; border-bottom:1px solid var(--line); cursor:pointer; }
.chat-line { border-bottom:1px solid var(--line); padding:8px 0; white-space:pre-wrap; }
#medicationFirstDose { width: auto; margin-right: 8px; }
.protocol-choice { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; line-height: 1.45; }
.protocol-choice input { width: 18px; min-width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; padding: 0; }
.protocol-choice span { min-width: 0; overflow-wrap: anywhere; }
.case-details li { margin: 9px 0; line-height: 1.45; }
.pending-chip { background: #fff5d9; color: #9a6a00; }
.empty-state {
  grid-column: 1 / -1; padding: 50px; text-align: center; color: var(--muted);
  background: #fff; border: 1px dashed #d8dae0; border-radius: 20px;
}
.cc-result {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; padding: 12px 14px; border: 1px solid #dfe8f8;
  border-radius: 12px; background: #f7faff;
}
.cc-result span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.cc-result button { width: auto; padding: 8px 11px; }
@media (max-width: 800px) { .patient-grid { grid-template-columns: 1fr; } }
@media (max-width: 650px) {
  .sidebar { display: block; position: sticky; top: 0; z-index: 10; width: 100%; height: auto; padding: 8px 12px; }
  .sidebar .brand, .sidebar-footer { display: none; }
  .sidebar nav { display: flex; gap: 5px; overflow-x: auto; }
  .sidebar .nav-item { font-size: 13px; flex: 0 0 auto; white-space: nowrap; }
  .sidebar .nav-item:before { content: none; }
  .staff-form { display: block; }
  .section-actions { flex-wrap: wrap; gap: 8px; }
}
:root { --blue: #111574; }
.brand-logo { width: 86px; height: 86px; object-fit: contain; border-radius: 18px; background: #fff; }
.brand-logo.small { width: 42px; height: 42px; border-radius: 10px; }
.messenger { display: grid; grid-template-columns: minmax(260px, 350px) minmax(0, 1fr); height: min(78vh, 760px); min-height: 450px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: 0 12px 32px #10131a0d; }
.messenger-inbox { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.messenger-inbox h3 { margin: 0; padding: 22px 20px 12px; }
.messenger-inbox input { margin: 0 15px 12px; width: calc(100% - 30px); background: #f2f3f7; border: 0; border-radius: 12px; padding: 11px 14px; }
.messenger-dialogs { overflow-y: auto; min-height: 0; }
.chat-inbox-row { padding: 12px 16px; gap: 11px; border: 0; transition: background .15s; }
.chat-inbox-row:hover, .chat-inbox-row.selected { background: #eef0fa; }
.chat-avatar { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-weight: 700; font-size: 15px; }
.dialog-copy { flex: 1; min-width: 0; display: grid; gap: 4px; }
.dialog-top { display: flex; align-items: baseline; gap: 6px; justify-content: space-between; min-width: 0; }
.dialog-top b, .dialog-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dialog-top time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.dialog-preview { font-size: 13px; color: var(--muted); }
.chat-unread { min-width: 22px; height: 22px; padding: 2px 6px; border-radius: 13px; background: var(--blue); color: #fff; font-size: 12px; font-weight: bold; }
.messenger-conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.messenger-heading { min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.messenger-heading h3 { margin: 0 0 2px; font-size: 16px; }
.messenger-heading small { color: var(--muted); }
.messenger-messages { flex: 1; overflow-y: auto; padding: 20px 24px; background: #f4f6fb; }
.chat-empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.chat-day { margin: 12px auto; padding: 6px 12px; width: max-content; max-width: 100%; border-radius: 16px; background: #e1e5ef; color: #555e71; font-size: 11px; }
.chat-bubble-row { display: flex; margin: 7px 0; }
.chat-bubble-row.outgoing { justify-content: flex-end; }
.chat-bubble { max-width: min(78%, 540px); padding: 10px 13px 7px; border-radius: 16px 16px 16px 4px; background: #fff; box-shadow: 0 1px 3px #0001; overflow-wrap: anywhere; }
.outgoing .chat-bubble { background: #e2e6f8; border-radius: 16px 16px 4px 16px; }
.chat-bubble p { margin: 0; white-space: pre-wrap; line-height: 1.4; }
.chat-bubble time { display: block; margin-top: 3px; text-align: right; font-size: 10px; color: #757c8c; }
.messenger-compose { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); }
.messenger-compose textarea { min-height: 42px; max-height: 110px; padding: 10px 13px; resize: none; }
.messenger-compose button { width: 42px; height: 42px; border-radius: 50%; padding: 0; flex: 0 0 42px; }
.chat-back { display: none; border: 0; background: none; font-size: 30px; color: var(--blue); }
@media(max-width:700px) { .messenger { grid-template-columns: 1fr; height: 72vh; } .messenger-conversation { display: none; } #messagesView.chat-open .messenger-inbox { display: none; } #messagesView.chat-open .messenger-conversation { display: flex; } .chat-back { display: block; } }
