.tablet-care-view {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: auto;
  padding: 22px 24px 118px;
  isolation: isolate;
  color: #ffffff;
  background: #020303;
}

body.resident-view-care .resident-portal-home { grid-template-rows: minmax(0, 1fr) auto; }
body.resident-view-care .resident-portal-header { display: none !important; pointer-events: none !important; }
body.resident-view-care .resident-nav-grid { display: grid; }

.tablet-care-view[hidden], .tablet-care-panel[hidden], .tablet-care-drawer[hidden], [data-tablet-care-manage][hidden] { display: none !important; }

.tablet-care-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.tablet-care-identity p, .tablet-care-panel-heading p { margin: 0 0 3px; color: #77d8ff; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tablet-care-identity h1 { margin: 0; color: #ffffff; font-size: clamp(1.65rem, 3vw, 2.25rem); }
.tablet-care-role { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; background: rgba(255, 255, 255, .08); color: #ffffff; font-weight: 800; }

.tablet-care-message { min-height: 0; margin: 0 0 12px; padding: 0; border-radius: 8px; color: #aeefff; }
.tablet-care-message:not(:empty) { min-height: 44px; padding: 10px 14px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(11, 18, 24, .94); }
.tablet-care-message.error { border-color: rgba(255, 176, 165, .55); background: rgba(107, 27, 28, .44); color: #ffb0a5; }

.tablet-care-nav {
  position: sticky;
  top: -22px;
  z-index: 30;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 12px;
  background: linear-gradient(#020303 82%, transparent);
  scrollbar-width: none;
}
.tablet-care-nav::-webkit-scrollbar { display: none; }
.tablet-care-nav button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
}
.tablet-care-nav button.active { border-color: #3d9cff; background: #174f83; color: #fff; }
.tablet-care-nav button:focus-visible, .tablet-care-view button:focus-visible, .tablet-care-view input:focus-visible, .tablet-care-view select:focus-visible, .tablet-care-view textarea:focus-visible { outline: 3px solid #f0a323; outline-offset: 2px; }

.tablet-care-panel {
  min-height: 430px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(11, 18, 24, .84);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
}
.tablet-care-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.tablet-care-panel-heading h2 { margin: 0; color: #ffffff; font-size: 1.55rem; }
.tablet-care-panel-heading button, .tablet-care-admin-actions button, .tablet-care-drawer button, .tablet-care-action, [data-tablet-care-edit] {
  min-height: 46px;
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: #ffffff;
  font-weight: 800;
}
.tablet-care-admin-actions { display: flex; gap: 8px; }

.tablet-care-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tablet-care-card, .tablet-care-profile-card, .tablet-care-med-row {
  min-width: 0;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
}
.tablet-care-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tablet-care-card-title p, .tablet-care-card-title h3, .tablet-care-card-title span { margin: 0; }
.tablet-care-card h3, .tablet-care-med-row h3 { margin: 0; color: #ffffff; font-size: 1.12rem; }
.tablet-care-card p, .tablet-care-med-row p { margin: 7px 0 0; color: rgba(255, 255, 255, .78); }
.tablet-care-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tablet-care-card-actions a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 8px 13px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; background: rgba(255, 255, 255, .08); color: #77d8ff; font-weight: 800; text-decoration: none; }
.tablet-care-card.inactive, .tablet-care-med-row.inactive { opacity: .68; }
.tablet-care-muted { color: rgba(255, 255, 255, .62); font-style: italic; }
.tablet-care-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tablet-care-tag { display: inline-flex; align-items: center; width: max-content; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .86); font-size: .78rem; font-weight: 900; }
.tablet-care-tag.primary { background: rgba(61, 156, 255, .2); color: #aeefff; }
.tablet-care-profile { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr); gap: 14px; }
.tablet-care-profile-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.tablet-care-profile-card dt { color: rgba(255, 255, 255, .62); font-size: .82rem; font-weight: 800; text-transform: uppercase; }
.tablet-care-profile-card dd { margin: 3px 0 0; color: #ffffff; font-weight: 700; }
.tablet-care-profile-related { display: grid; gap: 10px; }
.tablet-care-profile-related article { padding: 13px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; background: rgba(255, 255, 255, .07); }
.tablet-care-profile-related h3 { margin: 0 0 8px; font-size: 1rem; }
.tablet-care-profile-related ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.tablet-care-profile-related li { display: grid; gap: 2px; }

.tablet-care-med-list { display: grid; gap: 10px; }
.tablet-care-schedule-list { display: grid; gap: 10px; }
.tablet-care-schedule-heading { margin-bottom: 12px; }
.tablet-care-schedule-timezone { display: block; margin-top: 4px; color: rgba(255, 255, 255, .62); font-size: .86rem; }
.tablet-care-day-nav { display: grid; grid-template-columns: 52px auto minmax(180px, 240px) 52px; justify-content: center; align-items: end; gap: 9px; margin-bottom: 14px; padding: 11px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; background: rgba(255, 255, 255, .05); }
.tablet-care-day-nav button, .tablet-care-day-nav input, .tablet-care-schedule-state button { min-height: 48px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-weight: 800; }
.tablet-care-day-nav label { display: grid; gap: 4px; color: rgba(255, 255, 255, .7); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.tablet-care-day-nav input { width: 100%; padding: 8px 12px; color-scheme: dark; }
.tablet-care-schedule-state { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 0; margin-bottom: 10px; color: #b9e9ff; }
.tablet-care-schedule-state:not(:empty) { min-height: 48px; padding: 9px 12px; border: 1px solid rgba(119, 216, 255, .28); border-radius: 8px; background: rgba(15, 82, 116, .2); }
.tablet-care-schedule-state.error { border-color: rgba(255, 176, 165, .5); background: rgba(107, 27, 28, .3); color: #ffb0a5; }
.tablet-care-schedule-state button { flex: 0 0 auto; padding: 8px 14px; }
.tablet-care-schedule-loading { display: grid; gap: 10px; }
.tablet-care-schedule-loading span { min-height: 82px; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.12), rgba(255,255,255,.05)); background-size: 200% 100%; animation: tablet-care-loading 1.4s linear infinite; }
@keyframes tablet-care-loading { to { background-position: -200% 0; } }
.tablet-care-schedule-row { width: 100%; min-height: 88px; display: grid; grid-template-columns: minmax(150px, .35fr) minmax(0, 1fr) 24px; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; background: rgba(255, 255, 255, .07); color: #fff; text-align: left; }
button.tablet-care-schedule-row { cursor: pointer; }
button.tablet-care-schedule-row:hover { border-color: rgba(119, 216, 255, .55); background: rgba(61, 156, 255, .12); }
.tablet-care-schedule-when { display: grid; gap: 4px; padding-right: 16px; border-right: 1px solid rgba(255, 255, 255, .14); }
.tablet-care-schedule-when strong { color: #ffffff; }
.tablet-care-schedule-when span, .tablet-care-schedule-main p { color: rgba(255, 255, 255, .68); }
.tablet-care-schedule-main h3 { margin: 7px 0 0; color: #ffffff; font-size: 1.1rem; }
.tablet-care-schedule-main p { margin: 4px 0 0; }
.tablet-care-med-row { display: grid; grid-template-columns: minmax(190px, 1.25fr) minmax(130px, .7fr) minmax(160px, 1fr) minmax(180px, 1fr) auto; align-items: center; gap: 12px; }
.tablet-care-med-row > div > span:not(.tablet-care-tag) { display: block; color: rgba(255, 255, 255, .62); font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.tablet-care-med-row > div > strong { display: block; color: #ffffff; }
.tablet-care-boundary { margin: -2px 0 15px; padding: 11px 14px; border-left: 5px solid #e0a126; border-radius: 8px; background: rgba(224, 161, 38, .13); color: #ffe09a; }

.tablet-care-empty { min-height: 130px; display: grid; place-items: center; padding: 25px; border: 1px dashed rgba(255, 255, 255, .28); border-radius: 8px; color: rgba(255, 255, 255, .68); text-align: center; }

.tablet-care-drawer { position: fixed; inset: 0; z-index: 10000; }
.tablet-care-drawer-backdrop { position: absolute; inset: 0; background: rgba(7, 12, 22, .58); }
.tablet-care-drawer-sheet { position: absolute; top: 0; right: 0; width: min(620px, 78vw); height: 100%; overflow: auto; padding: 20px; background: #0b1218; color: #ffffff; box-shadow: -18px 0 40px rgba(0, 0, 0, .45); }
.tablet-care-drawer-sheet > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .18); }
.tablet-care-drawer-sheet header p, .tablet-care-drawer-sheet header h2 { margin: 0; }
.tablet-care-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 18px 0; }
.tablet-care-form-grid label { display: grid; gap: 6px; color: rgba(255, 255, 255, .82); font-weight: 800; }
.tablet-care-form-grid label.wide { grid-column: 1 / -1; }
.tablet-care-form-grid input, .tablet-care-form-grid select, .tablet-care-form-grid textarea { width: 100%; min-height: 48px; padding: 9px 11px; border: 1px solid rgba(255, 255, 255, .24); border-radius: 8px; background: #121d27; color: #ffffff; font: inherit; }
.tablet-care-form-grid textarea { min-height: 90px; resize: vertical; }
.tablet-care-form-grid select[multiple] { min-height: 128px; }
.tablet-care-form-message { min-height: 24px; color: #ffb0a5; }
.tablet-care-drawer footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .18); }
.tablet-care-footer-spacer { flex: 1; }
.tablet-care-drawer button.danger { border-color: #e86778; color: #ffb0bd; }
.tablet-care-drawer button.primary { border-color: #174f83; background: #174f83; color: #fff; }

@media (max-width: 900px) {
  .tablet-care-card-grid, .tablet-care-profile { grid-template-columns: 1fr; }
  .tablet-care-med-row { grid-template-columns: minmax(0, 1.2fr) minmax(120px, .8fr) minmax(0, 1fr); }
  .tablet-care-med-row > :nth-child(4) { grid-column: 1 / 3; }
}

@media (max-width: 680px) {
  .tablet-care-view { padding: 14px 14px 108px; }
  .tablet-care-header { grid-template-columns: 1fr; }
  .tablet-care-role { justify-self: start; }
  .tablet-care-panel { padding: 14px; }
  .tablet-care-panel-heading { align-items: flex-start; flex-direction: column; }
  .tablet-care-med-row { grid-template-columns: 1fr; }
  .tablet-care-day-nav { grid-template-columns: 52px 1fr 52px; }
  .tablet-care-day-nav label { grid-column: 1 / -1; grid-row: 2; }
  .tablet-care-schedule-row { grid-template-columns: 1fr 24px; }
  .tablet-care-schedule-when { padding-right: 0; padding-bottom: 10px; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .14); }
  .tablet-care-schedule-main { grid-column: 1; }
  .tablet-care-med-row > :nth-child(4) { grid-column: auto; }
  .tablet-care-profile-card dl, .tablet-care-form-grid { grid-template-columns: 1fr; }
  .tablet-care-drawer-sheet { width: 94vw; }
}
