:root {
  color-scheme: light;
  --ink: #24313a;
  --muted: #64727c;
  --line: #d8e0df;
  --paper: #f8f6f1;
  --panel: #ffffff;
  --teal: #107b76;
  --teal-dark: #075954;
  --coral: #df6d55;
  --gold: #d39a28;
  --blue: #426f98;
  --shadow: 0 18px 45px rgba(23, 38, 44, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #f5f0e8 0%, #eef7f5 48%, #fff8f2 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1420px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 24px;
  padding: 24px;
}

.resident-panel,
.assistant-stage {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(216, 224, 223, 0.9);
  box-shadow: var(--shadow);
}

.resident-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  border-radius: 8px;
}

.brand,
.topbar,
.connection,
.assistant-card,
.task,
.refill-box,
.caregiver-grid,
.note-controls,
.status-list div {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
  line-height: 1.15;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.04rem;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.profile {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.profile img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.profile-copy {
  padding: 18px;
}

.profile-copy p:last-child,
.task p,
.caregiver-grid p,
.refill-box p {
  margin-bottom: 0;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-list div {
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: #33434b;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 99px;
}

.good,
.badge.good {
  background: #dff2e9;
  color: #166044;
}

.status-dot.good {
  background: #1c996a;
}

.due,
.badge.due {
  background: #fff0d7;
  color: #84570a;
}

.status-dot.due {
  background: var(--gold);
}

.watch,
.badge.neutral {
  background: #e8eef7;
  color: #34506f;
}

.status-dot.watch {
  background: var(--blue);
}

.assistant-stage {
  min-width: 0;
  border-radius: 8px;
  padding: 22px;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab.active {
  color: white;
  background: var(--teal-dark);
}

.connection {
  gap: 8px;
  color: var(--teal-dark);
  font-weight: 800;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(16, 123, 118, 0.13);
}

.assistant-card {
  gap: 18px;
  padding: 20px;
  margin-bottom: 22px;
  border-radius: 8px;
  background: #113d3f;
  color: white;
}

.assistant-card .eyebrow,
.assistant-card p {
  color: rgba(255, 255, 255, 0.76);
}

.assistant-card h2 {
  color: white;
}

.avatar {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(140deg, #e8fffb, #fce2d7);
}

.avatar-face {
  width: 48px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 3px solid #164f52;
  border-radius: 18px;
}

.avatar-face span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #164f52;
}

.content-view {
  display: none;
}

.content-view.active {
  display: block;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.task {
  min-height: 212px;
  align-items: flex-start;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.task.primary {
  border-color: rgba(223, 109, 85, 0.45);
  background: #fff8f4;
}

.task-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7f4f1;
  color: var(--teal-dark);
  font-weight: 900;
}

.action {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--coral);
  color: white;
  cursor: pointer;
  font-weight: 900;
}

.action.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--teal-dark);
}

.task .action {
  margin-top: auto;
  width: 100%;
}

.timeline,
.med-table,
.refill-box,
.note-form {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.timeline h2 {
  font-size: 1.08rem;
}

.timeline ol {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  color: var(--muted);
}

.timeline strong {
  color: var(--ink);
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 120px;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row.header {
  min-height: 38px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 900;
}

.refill-box {
  justify-content: space-between;
  gap: 18px;
}

.caregiver-grid {
  align-items: stretch;
  gap: 14px;
}

.caregiver-grid article {
  flex: 1 1 0;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.note-form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 900;
}

.note-controls {
  gap: 10px;
}

.note-controls input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .resident-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .brand,
  .status-list {
    grid-column: 1 / -1;
  }

  .task-grid,
  .caregiver-grid {
    grid-template-columns: 1fr;
    display: grid;
  }
}

@media (max-width: 620px) {
  .resident-panel,
  .assistant-stage {
    padding: 14px;
  }

  .resident-panel {
    display: flex;
  }

  .topbar,
  .assistant-card,
  .refill-box,
  .note-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .timeline li,
  .table-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
  }

  .table-row.header {
    display: none;
  }
}
