/* An independent, scrollable ward section; room actions stay in normal flow. */
body.embed .room-panel.has-patients { display: none !important; }
.patient-details {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  margin: 12px 0 5px;
  padding-top: 12px;
  border-top: 1px solid #7fbed52a;
  color: #c8e6ed;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.patient-details-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.patient-details-heading h4 {
  min-width: 0;
  margin: 0;
  color: #e2f7fd;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .8px;
}
.patient-demo-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid #ffc25043;
  border-radius: 4px;
  color: #f7d99c;
  background: #ffc25010;
  font-size: 9px;
  line-height: 1.35;
  white-space: nowrap;
}
.patient-details-meta {
  flex: 0 0 auto;
  margin: 5px 0 9px;
  color: #89aab9;
  font-size: 9px;
  line-height: 1.4;
}
.patient-bed-list {
  display: grid;
  flex: 1 1 auto;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  max-height: min(330px, 38dvh);
  padding: 1px 4px 2px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #55c8c960 transparent;
  scroll-snap-type: y proximity;
}
.patient-bed-list::-webkit-scrollbar {
  width: 3px;
}
.patient-bed-list::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: #55c8c960;
}
.patient-bed-list:focus-visible {
  outline: 1px solid #63e5da;
  outline-offset: 2px;
  border-radius: 6px;
}
.patient-bed-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid #51d2cc33;
  border-radius: 7px;
  background: linear-gradient(135deg, #1c505342, #12334568);
  box-shadow: inset 0 1px 0 #bdfff708;
  scroll-snap-align: start;
}
.patient-bed-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.patient-bed-number {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.patient-bed-mark {
  display: grid;
  place-items: center;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  border: 1px solid #63dbd456;
  border-radius: 4px;
  color: #8af2e4;
  background: #32ddb715;
  font-family: Oxanium, ui-monospace, monospace;
  font-size: 10px;
  line-height: 1;
}
.patient-bed-number strong {
  min-width: 0;
  color: #d8f6f7;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.patient-bed-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: #77edc7;
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
}
.patient-bed-state::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #63e5b7;
  box-shadow: 0 0 6px #32ddb74a;
}
.patient-identity {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 9px 0 10px;
}
.patient-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #6ad2dd3b;
  border-radius: 9px;
  color: #b6f1f6;
  background: linear-gradient(135deg, #479aff25, #25deef13);
  font-size: 13px;
  line-height: 1;
}
.patient-person {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.patient-name {
  color: #e4f8fc;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
}
.patient-demographics {
  color: #9ab7c4;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}
.patient-nursing-level {
  padding: 3px 5px;
  border: 1px solid #479aff3a;
  border-radius: 4px;
  color: #b3d8ff;
  background: #479aff13;
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
}
.patient-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px solid #77b7ca18;
}
.patient-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.patient-field dt {
  color: #82a8b9;
  font-size: 9px;
  line-height: 1.3;
}
.patient-field dd {
  min-width: 0;
  margin: 0;
  color: #c4e3ec;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.patient-empty {
  padding: 12px;
  color: #92afbd;
  font-size: 11px;
  line-height: 1.4;
}
.room-panel .patient-details ~ .focus-button {
  position: relative;
  flex: 0 0 auto;
}

/* Only ward panels gain the expanded patient layout. */
.dashboard-mode .room-panel.has-patients {
  display: flex;
  flex-direction: column;
  width: 300px;
  min-width: 0;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #55c8c960 transparent;
}
.dashboard-mode .room-panel.has-patients[hidden] {
  display: none;
}
.dashboard-mode .room-panel.has-patients > .room-detail-heading {
  flex: 0 0 auto;
  padding-bottom: 9px;
  gap: 5px 9px;
}
.dashboard-mode .room-panel.has-patients > .room-number {
  flex: 0 0 auto;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1.1;
}
.dashboard-mode .room-panel.has-patients > h3 {
  flex: 0 0 auto;
  margin: 7px 0 5px;
  font-size: 13px;
  line-height: 1.35;
}
.dashboard-mode .room-panel.has-patients > #room-description {
  flex: 0 0 auto;
  min-height: 0;
  margin: 0;
  font-size: 10px;
  line-height: 1.6;
}
.dashboard-mode .room-panel.has-patients > .room-fields {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 9px 0 0;
}
.dashboard-mode .room-panel.has-patients > .room-fields > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  margin: 0;
  font-size: 9px;
  line-height: 1.3;
}
.dashboard-mode .room-panel.has-patients > .room-fields b {
  color: #b9dbe4;
  font-size: 10px;
  line-height: 1.35;
}
.dashboard-mode .room-panel.has-patients > #ward-patient-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.dashboard-mode .room-panel.has-patients > #ward-patient-info > .patient-details {
  width: 100%;
}
.dashboard-mode .room-panel.has-patients > .focus-button {
  position: static;
  flex: 0 0 auto;
  padding-top: 9px;
  line-height: 1.4;
}
.dashboard-mode .room-panel.has-patients > .focus-button[hidden] {
  display: none;
}
@media (min-width: 761px) {
  .dashboard-mode .room-panel.has-patients {
    height: auto;
    max-height: min(690px, calc(100dvh - var(--header-h, 74px) - var(--footer-h, 64px) - 160px));
  }
}
@media (max-width: 760px), (max-height: 700px) {
  .patient-details {
    margin-top: 10px;
    padding-top: 9px;
  }
  .patient-bed-list {
    max-height: min(254px, 36dvh);
  }
  .patient-bed-card {
    padding: 9px;
  }
}
@media (max-width: 760px) {
  .dashboard-mode .room-panel.has-patients,
  .dashboard-mode.scene-only .room-panel.has-patients {
    position: fixed;
    top: calc(var(--header-h, 112px) + 12px);
    right: 16px;
    bottom: calc(var(--footer-h, 64px) + 24px);
    width: min(300px, calc(100vw - 32px));
    height: auto;
    max-height: none;
    z-index: 9;
    padding: 11px 12px;
    background: linear-gradient(135deg, #173c46f5, #102d3ef7);
    box-shadow: 0 16px 50px #051320b3, inset 3px 0 0 #48d5b4;
  }
  .dashboard-mode .room-panel.has-patients > .room-detail-heading {
    padding-bottom: 7px;
    gap: 3px 9px;
  }
  .dashboard-mode .room-panel.has-patients > .room-number,
  .dashboard-mode .room-panel.has-patients > #room-description,
  .dashboard-mode .room-panel.has-patients > .room-fields {
    display: none;
  }
  .dashboard-mode .room-panel.has-patients > h3 {
    margin: 7px 0 0;
    font-size: 13px;
    line-height: 1.3;
  }
  .dashboard-mode .room-panel.has-patients > #ward-patient-info {
    flex: 1 1 auto;
    min-height: 0;
  }
  .dashboard-mode .room-panel.has-patients .patient-details {
    margin: 7px 0 3px;
    padding-top: 7px;
  }
  .dashboard-mode .room-panel.has-patients .patient-details-heading h4 {
    font-size: 11px;
  }
  .dashboard-mode .room-panel.has-patients .patient-details-meta {
    margin: 3px 0 5px;
    font-size: 8px;
    line-height: 1.25;
  }
  .dashboard-mode .room-panel.has-patients .patient-bed-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(250px, 34dvh);
    gap: 6px;
  }
  .dashboard-mode .room-panel.has-patients .patient-bed-card {
    padding: 7px 8px;
  }
  .dashboard-mode .room-panel.has-patients .patient-bed-mark {
    flex-basis: 16px;
    width: 16px;
    height: 16px;
    font-size: 9px;
  }
  .dashboard-mode .room-panel.has-patients .patient-bed-number strong {
    font-size: 10px;
  }
  .dashboard-mode .room-panel.has-patients .patient-identity {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 6px;
    margin: 5px 0 6px;
  }
  .dashboard-mode .room-panel.has-patients .patient-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .dashboard-mode .room-panel.has-patients .patient-name {
    font-size: 12px;
  }
  .dashboard-mode .room-panel.has-patients .patient-person {
    gap: 2px;
  }
  .dashboard-mode .room-panel.has-patients .patient-fields {
    gap: 6px 10px;
    padding-top: 6px;
  }
  .dashboard-mode .room-panel.has-patients .patient-field {
    gap: 2px;
  }
  .dashboard-mode .room-panel.has-patients .patient-field dd {
    font-size: 10px;
    line-height: 1.2;
  }
  .dashboard-mode .room-panel.has-patients > .focus-button {
    flex: 0 0 auto;
    min-height: 24px;
    padding: 5px 0 0;
    font-size: 10px;
    line-height: 1.35;
  }
}
@media (max-width: 399px) {
  .patient-fields {
    column-gap: 8px;
  }
  .patient-identity {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 6px;
  }
  .patient-avatar {
    width: 28px;
    height: 28px;
  }
}
