.resident-care-workspace {
  width: min(100% - 32px, 1080px);
  max-width: 1080px;
  margin: 0 auto;
  color: #16362c;
  font-size: 18px;
  line-height: 1.55;
}

.resident-care-workspace label {
  display: grid;
  gap: 8px;
  color: #285347;
  font-size: 17px;
  font-weight: 700;
}

.resident-care-workspace button,
.resident-care-workspace input,
.resident-care-workspace select,
.resident-care-workspace textarea {
  box-sizing: border-box;
  min-height: 48px;
  font: inherit;
}

.resident-care-workspace textarea {
  min-height: 128px;
  resize: vertical;
}

.resident-care-context-summary,
.resident-care-context-editor {
  display: grid;
  gap: 16px;
}

.resident-care-context-level,
.resident-care-context-background,
.resident-care-context-editor {
  border: 1px solid #c8d8d0;
  border-radius: 8px;
  background: #ffffff;
}

.resident-care-context-level > header,
.resident-care-context-background > summary,
.resident-care-context-note > header,
.resident-care-context-editor > header,
.resident-care-context-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.resident-care-context-level > header,
.resident-care-context-background > summary,
.resident-care-context-editor > header {
  padding: 14px 16px;
  border-bottom: 1px solid #e1ebe6;
}

.resident-care-context-level h3,
.resident-care-context-editor h2 {
  margin: 0;
  color: #104030;
  font-size: 20px;
}

.resident-care-context-background > summary {
  cursor: pointer;
  list-style: none;
  color: #104030;
  font-weight: 700;
}

.resident-care-context-background > summary::-webkit-details-marker {
  display: none;
}

.resident-care-context-background-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.resident-care-context-note {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid #e1ebe6;
}

.resident-care-context-note.is-unread {
  border-left: 4px solid #c98b18;
  background: #fffaf0;
}

.resident-care-context-note > header {
  align-items: flex-start;
}

.resident-care-context-category {
  color: #104030;
  font-weight: 800;
}

.resident-care-context-version,
.resident-care-context-read,
.resident-care-context-unread {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
}

.resident-care-context-version,
.resident-care-context-read {
  color: #31594d;
  background: #e8f2ed;
}

.resident-care-context-unread {
  color: #6d4710;
  background: #fff0cc;
}

.resident-care-context-content {
  margin: 0;
  overflow-wrap: anywhere;
}

.resident-care-context-meta,
.resident-care-context-editor-readonly {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
  margin: 0;
}

.resident-care-context-meta div,
.resident-care-context-editor-readonly div {
  min-width: 0;
}

.resident-care-context-meta dt,
.resident-care-context-editor-readonly dt {
  color: #577166;
  font-size: 15px;
}

.resident-care-context-meta dd,
.resident-care-context-editor-readonly dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.resident-care-context-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.resident-care-context-empty,
.resident-care-context-editor-error,
.resident-care-context-editor-info {
  margin: 0;
  padding: 14px 16px;
}

.resident-care-context-editor-error {
  color: #8f1d18;
  background: #fff2f1;
}

.resident-care-context-editor-info {
  color: #1f5b45;
  background: #edf8f1;
}

.resident-care-context-editor > form {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.resident-care-follow-up-queue,
.resident-care-follow-up-list {
  display: grid;
  gap: 14px;
}

.resident-care-follow-up-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid #c8d8d0;
  border-radius: 8px;
  background: #f8fbf9;
}

.resident-care-follow-up-create {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line, #d9d9df);
}

.resident-care-follow-up-create label {
  display: grid;
  gap: 6px;
}

.resident-care-follow-up-description,
.resident-care-follow-up-create .resident-care-form-actions {
  grid-column: 1 / -1;
}

@media (max-width: 820px) {
  .resident-care-follow-up-create { grid-template-columns: 1fr; }
}

.resident-care-follow-up-row {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #c8d8d0;
  border-radius: 8px;
  background: #ffffff;
}

.resident-care-follow-up-row > header,
.resident-care-follow-up-row > header > div,
.resident-care-follow-up-row dl,
.resident-care-follow-up-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.resident-care-follow-up-row > header,
.resident-care-follow-up-actions {
  justify-content: space-between;
}

.resident-care-follow-up-row h3,
.resident-care-follow-up-row p {
  margin: 0;
}

.resident-care-follow-up-row dl {
  flex-wrap: wrap;
  margin: 0;
}

.resident-care-follow-up-row dl div {
  min-width: 150px;
}

.resident-care-follow-up-row dt {
  color: #577166;
  font-size: 15px;
}

.resident-care-follow-up-row dd {
  margin: 2px 0 0;
}

.resident-care-follow-up-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  color: #285347;
  background: #e8f2ed;
  font-size: 15px;
  font-weight: 700;
}

.resident-care-follow-up-status.status-overdue {
  color: #8f1d18;
  background: #fff2f1;
}

.resident-care-workspace-header,
.resident-care-section > header,
.resident-care-hospital-case > header,
.resident-care-settings-sheet > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.resident-care-workspace-header {
  padding: 22px 0 18px;
  border-bottom: 1px solid #c8d8d0;
}

.resident-care-workspace-header span,
.resident-care-workspace-header p,
.resident-care-section > header p,
.resident-care-hospital-case > header p,
.resident-care-settings-sheet > header p {
  margin: 0;
}

.resident-care-workspace-header span {
  color: #ad7417;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.resident-care-workspace-header h1,
.resident-care-section h2,
.resident-care-hospital-case h3,
.resident-care-settings-sheet h2 {
  margin: 4px 0 6px;
  color: #104030;
}

.resident-care-workspace-header h1 {
  font-size: 28px;
}

.resident-care-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid #e1ebe6;
}

.resident-care-tabs button {
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid #b7cec3;
  border-radius: 6px;
  color: #174c3d;
  background: #fff;
}

.resident-care-tabs button.active {
  border-color: #104030;
  color: #fff;
  background: #104030;
}

.resident-care-resident-picker {
  width: min(100%, 420px);
  margin: 18px 0;
}

.resident-care-section,
.resident-care-hospital-case,
.resident-care-settings-sheet {
  display: grid;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid #dbe7e1;
}

.resident-care-section > header h2,
.resident-care-hospital-case h3,
.resident-care-settings-sheet h2 {
  font-size: 22px;
}

.resident-care-resident-summary,
.resident-care-hospital-case > header > span,
.resident-care-case-meta,
.resident-care-feature-control {
  padding: 12px 14px;
  border: 1px solid #c8d8d0;
  border-radius: 6px;
  color: #174c3d;
  background: #f8fbf9;
}

.resident-care-resident-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.resident-care-resident-summary strong {
  color: #104030;
}

.resident-care-hospital-case {
  padding: 16px;
  border: 1px solid #c8d8d0;
  border-left: 4px solid #d99a28;
  border-radius: 8px;
  background: #fff;
}

.resident-care-hospital-case form,
.resident-care-hospital-contact-outcome,
.resident-care-settings-programs,
.resident-care-case-meta {
  display: grid;
  gap: 14px;
}

.resident-care-prn-list,
.resident-care-prn-card form,
.resident-care-prn-review-queue,
.resident-care-prn-review-queue > article,
.resident-care-prn-review-queue form {
  display: grid;
  gap: 14px;
}

.resident-care-prn-card,
.resident-care-prn-review-queue > article {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #c8d8d0;
  border-radius: 8px;
  background: #ffffff;
}

.resident-care-prn-card > header,
.resident-care-prn-review-queue > header,
.resident-care-prn-review-queue > article > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.resident-care-prn-card h3,
.resident-care-prn-card p,
.resident-care-prn-review-queue h2,
.resident-care-prn-review-queue h3,
.resident-care-prn-review-queue p {
  margin: 0;
}

.resident-care-prn-card h3,
.resident-care-prn-review-queue h2,
.resident-care-prn-review-queue h3 {
  color: #104030;
}

.resident-care-prn-frequency {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  color: #174c3d;
  background: #e8f2ed;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.resident-care-prn-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  padding: 12px 14px;
  border-left: 4px solid #2c7660;
  background: #f3f9f6;
}

.resident-care-prn-summary strong {
  color: #104030;
}

.resident-care-prn-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 0;
  padding: 14px;
  border: 1px solid #c8d8d0;
  border-radius: 6px;
}

.resident-care-prn-options legend {
  padding: 0 6px;
  color: #285347;
  font-size: 17px;
  font-weight: 800;
}

.resident-care-workspace .resident-care-prn-options > label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  color: #16362c;
  font-size: 18px;
  font-weight: 500;
}

.resident-care-workspace .resident-care-prn-options input[type="checkbox"] {
  width: 20px;
  min-width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 0;
}

.resident-care-prn-conditional[hidden],
.resident-care-prn-record-link[hidden],
.resident-care-prn-review-notice[hidden] {
  display: none;
}

.resident-care-prn-record-link,
.resident-care-prn-review-notice {
  padding: 12px 14px;
  border: 1px solid #d9a640;
  border-radius: 6px;
  color: #5b3d07;
  background: #fff8e6;
}

.resident-care-prn-review-notice {
  margin: 0;
  font-weight: 700;
}

.resident-care-prn-review-queue {
  margin-top: 10px;
  padding-top: 20px;
  border-top: 2px solid #c8d8d0;
}

.resident-care-prn-review-queue > article {
  border-left: 4px solid #d99a28;
}

.resident-care-admission-confirmation,
.resident-care-admission-assessment {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #c8d8d0;
  border-radius: 8px;
  background: #ffffff;
}

.resident-care-admission-confirmation {
  border-left: 4px solid #d99a28;
}

.resident-care-admission-confirmation > header,
.resident-care-admission-assessment > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.resident-care-admission-confirmation h3,
.resident-care-admission-confirmation p,
.resident-care-admission-assessment h3,
.resident-care-admission-assessment p {
  margin: 0;
}

.resident-care-admission-confirmation h3,
.resident-care-admission-assessment h3 {
  color: #104030;
}

.resident-care-admission-confirmation > header > span,
.resident-care-admission-assessment > header > span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  color: #6d4710;
  background: #fff0cc;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.resident-care-admission-confirmation form,
.resident-care-admission-assessment form {
  display: grid;
  gap: 16px;
}

.resident-care-admission-confirm-note {
  padding: 12px 14px;
  border-left: 4px solid #d99a28;
  color: #5b3d07;
  background: #fff8e6;
}

.resident-care-admission-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #c8d8d0;
  border-radius: 6px;
  background: #f8fbf9;
}

.resident-care-admission-progress progress {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 10px;
  accent-color: #167252;
}

.resident-care-admission-save-state {
  color: #577166;
  font-size: 16px;
}

.resident-care-admission-section {
  border: 1px solid #d7e3dd;
  border-radius: 6px;
  background: #ffffff;
}

.resident-care-admission-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  cursor: pointer;
  color: #104030;
  font-size: 18px;
  font-weight: 800;
}

.resident-care-admission-section > summary small {
  color: #577166;
  font-size: 15px;
  font-weight: 600;
}

.resident-care-admission-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  border-top: 1px solid #e1ebe6;
}

.resident-care-admission-fields textarea {
  min-height: 88px;
}

.resident-care-admission-preview,
.resident-care-admission-conflict {
  padding: 14px 16px;
  border-radius: 6px;
}

.resident-care-admission-preview {
  border: 1px solid #d9a640;
  background: #fff8e6;
}

.resident-care-admission-missing-list strong,
.resident-care-admission-missing-list ul,
.resident-care-admission-missing-ok {
  margin: 0;
}

.resident-care-admission-missing-list ul {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-left: 24px;
}

.resident-care-admission-missing-ok {
  color: #1f5b45;
  font-weight: 700;
}

.resident-care-admission-conflict {
  display: grid;
  gap: 10px;
  border: 1px solid #efc5c2;
  border-left: 4px solid #b42318;
  color: #701c18;
  background: #fff2f1;
}

.resident-care-hospital-contact-outcome,
.resident-care-settings-programs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resident-care-quick-templates,
.resident-care-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resident-care-quick-templates button,
.resident-care-actions button {
  min-height: 48px;
}

.resident-care-message,
.resident-care-empty {
  margin: 0;
  padding: 14px 16px;
  border-radius: 6px;
}

.resident-care-message.error {
  color: #8f1d18;
  border: 1px solid #efc5c2;
  background: #fff2f1;
}

.resident-care-message.info {
  color: #1f5b45;
  border: 1px solid #bddfcf;
  background: #edf8f1;
}

.resident-care-empty {
  color: #405f54;
  border: 1px dashed #b7cec3;
  background: #f8fbf9;
}

.resident-care-eol-banner {
  display: grid;
  gap: 5px;
  margin: 10px 0;
  padding: 14px 16px;
  border: 1px solid #d9a640;
  border-left: 5px solid #b7790a;
  border-radius: 6px;
  color: #5b3d07;
  background: #fff8e6;
  font-size: 18px;
}

.resident-care-eol-banner strong {
  color: #704900;
}

.resident-care-photo-view {
  max-width: 680px;
}

.resident-care-photo-card,
.resident-care-photo-empty {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 18px;
  border: 1px solid #c8d8d0;
  border-radius: 8px;
  background: #ffffff;
}

.resident-care-photo-frame,
.resident-care-photo-empty > span {
  display: grid;
  width: 220px;
  height: 220px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #b7cec3;
  border-radius: 8px;
  color: #174c3d;
  background: #e8f2ed;
}

.resident-care-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resident-care-photo-initials,
.resident-care-photo-empty > span {
  font-size: 42px;
  font-weight: 800;
}

.resident-care-photo-detail {
  display: grid;
  gap: 10px;
  align-content: center;
}

.resident-care-photo-detail strong,
.resident-care-photo-detail p,
.resident-care-photo-empty p {
  margin: 0;
}

.resident-care-photo-detail button {
  justify-self: start;
  min-width: 154px;
}

.resident-care-photo-empty {
  grid-template-columns: 96px minmax(0, 1fr);
  color: #405f54;
  background: #f8fbf9;
}

.resident-care-photo-empty > span {
  width: 96px;
  height: 96px;
}

.handover-meeting-card .resident-care-eol-banner {
  margin: 12px 0 4px;
}

.resident-care-case-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.resident-care-case-meta dt {
  color: #577166;
  font-size: 15px;
}

.resident-care-case-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.resident-care-settings-sheet {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #9fb9ad;
  border-radius: 8px;
  background: #fff;
}

.resident-care-settings-programs > article {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(100px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid #e1ebe6;
}

.resident-care-check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.resident-care-check input {
  width: 20px;
  min-height: 20px;
}

.follow-up-control {
  display: grid;
  gap: 6px;
}

.record-follow-up-link-error {
  display: grid;
  gap: 6px;
  color: #8f1d18;
  font-size: 14px;
}

.record-follow-up-link-error button {
  min-height: 36px;
}

@media (max-width: 980px) {
  .resident-care-follow-up-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resident-care-hospital-contact-outcome,
  .resident-care-settings-programs > article {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .resident-care-workspace {
    width: min(100% - 20px, 1080px);
  }

  .resident-care-context-meta,
  .resident-care-context-editor-readonly {
    grid-template-columns: minmax(0, 1fr);
  }

  .resident-care-context-actions > button {
    flex: 1 1 100%;
  }

  .resident-care-follow-up-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .resident-care-follow-up-row > header,
  .resident-care-follow-up-row > header > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .resident-care-workspace-header,
  .resident-care-section > header,
  .resident-care-hospital-case > header,
  .resident-care-admission-confirmation > header,
  .resident-care-admission-assessment > header,
  .resident-care-settings-sheet > header {
    align-items: stretch;
    flex-direction: column;
  }

  .resident-care-tabs button,
  .resident-care-quick-templates button,
  .resident-care-actions > button,
  .resident-care-settings-programs > article > button {
    width: 100%;
  }

  .resident-care-hospital-contact-outcome,
  .resident-care-admission-fields,
  .resident-care-settings-programs > article,
  .resident-care-case-meta,
  .resident-care-photo-card,
  .resident-care-photo-empty {
    grid-template-columns: minmax(0, 1fr);
  }

  .resident-care-photo-frame {
    width: min(100%, 280px);
    height: auto;
    aspect-ratio: 1;
    justify-self: center;
  }

  .resident-care-photo-detail button {
    width: 100%;
  }

  .resident-care-admission-section > summary {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 10px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .resident-care-workspace * {
    scroll-behavior: auto;
  }
}
