:root {
  color-scheme: light;
  --ink: #15212a;
  --muted: #60707e;
  --line: #d9e2e7;
  --surface: #ffffff;
  --soft: #f5f8f7;
  --raised: #f7faf9;
  --tint: #eaf3f4;
  --table-head: #edf5f6;
  --mint: #d9f2e5;
  --teal: #16766f;
  --blue: #2b6fb6;
  --coral: #c86652;
  --gold: #b98523;
  --shadow: 0 18px 50px rgba(29, 54, 73, 0.12);
  --toast-bg: #15212a;
  --toast-ink: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf7f5;
  --muted: #aab9c2;
  --line: #29434b;
  --surface: #102128;
  --soft: #071418;
  --raised: #132b32;
  --tint: #18353b;
  --table-head: #173038;
  --mint: #173e36;
  --teal: #5fd0c4;
  --blue: #8bbcf4;
  --coral: #f19a86;
  --gold: #e2bd68;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  --toast-bg: #edf7f5;
  --toast-ink: #071418;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; }

a { color: inherit; }

.hidden,
.app-shell.loading {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.65fr);
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(17, 51, 57, 0.94), rgba(24, 110, 103, 0.62)),
    url("assets/care-journey.svg") center/cover no-repeat;
}

.onboarding-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(21, 33, 42, 0.56);
  overflow: auto;
}

.family-access-screen {
  min-height: 100vh;
  padding: 28px;
  background: var(--soft);
}

.payment-required-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--soft);
}

.payment-required-card {
  width: min(560px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.payment-required-card img {
  width: 52px;
  height: 52px;
}

.payment-required-card h1 {
  margin: 0;
  font-size: 2rem;
}

.payment-required-card p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.family-access-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.onboarding-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.onboarding-heading {
  margin-bottom: 18px;
}

.onboarding-heading p:not(.eyebrow) {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.onboarding-grid .wide {
  grid-column: 1 / -1;
}

.onboarding-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.auth-hero {
  min-width: 0;
  overflow: hidden;
  color: white;
  display: grid;
  align-content: center;
  padding: clamp(28px, 6vw, 84px);
}

.auth-hero img {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
}

.auth-hero h1 {
  font-size: clamp(3rem, 8vw, 7rem);
}

.auth-hero p:not(.eyebrow) {
  max-width: 620px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.12rem;
  line-height: 1.55;
}

.auth-video {
  width: min(640px, 100%);
  max-width: 100%;
  margin: 28px 0 0;
}

.auth-video iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: #071418;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

.auth-video figcaption {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  font-weight: 750;
}

.auth-card {
  align-self: center;
  width: min(440px, calc(100% - 36px));
  max-width: calc(100vw - 36px);
  margin: 24px auto;
  padding: 20px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.auth-tabs button.active {
  background: var(--mint);
  color: var(--teal);
  border-color: #a6d9c1;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.subscribe-panel {
  display: grid;
  gap: 12px;
}

.subscribe-heading {
  padding-bottom: 4px;
}

.subscribe-heading h2 {
  margin: 4px 0 8px;
  font-size: 2.2rem;
  line-height: 1;
}

.subscribe-heading p:not(.eyebrow),
.fine-print {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.plan-option {
  min-height: 128px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  cursor: pointer;
}

.plan-option:has(input:checked) {
  border-color: var(--teal);
  background: var(--mint);
}

.plan-option span,
.plan-option small {
  display: grid;
  gap: 5px;
}

.plan-option em {
  color: var(--teal);
  font-style: normal;
  font-weight: 900;
}

.plan-option small {
  color: var(--muted);
  line-height: 1.35;
}

.benefit-list {
  margin: 0;
  padding: 12px 14px 12px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  display: grid;
  gap: 8px;
  line-height: 1.35;
}

.policy-checklist {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
}

.policy-checklist label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.35;
}

.policy-checklist input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.policy-checklist a {
  color: var(--blue);
  font-weight: 900;
}

.auth-form .primary-action {
  margin-top: 4px;
}

.link-action {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 850;
  text-align: left;
  cursor: pointer;
  padding: 4px 0;
}

.auth-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.18rem;
}

.brand img {
  width: 42px;
  height: 42px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
}

.nav-link span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--teal);
}

.nav-link:hover,
.nav-link.active {
  background: var(--mint);
  color: var(--ink);
}

.admin-nav {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-nav .nav-link {
  min-height: 38px;
  font-size: 0.88rem;
  background: var(--raised);
}

.privacy-note {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
}

.privacy-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar,
.section-heading,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.heading-with-tip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.heading-with-tip h2 {
  margin: 0;
}

.help-tip {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tint);
  color: var(--teal);
  cursor: help;
  font-weight: 950;
  line-height: 1;
}

.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(320px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.help-tip::before {
  content: "";
  position: absolute;
  z-index: 13;
  left: 50%;
  bottom: calc(100% + 4px);
  width: 12px;
  height: 12px;
  background: var(--toast-bg);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) rotate(45deg);
  transition: opacity 140ms ease;
}

.help-tip:hover::after,
.help-tip:focus::after,
.help-tip:focus-visible::after,
.help-tip:hover::before,
.help-tip:focus::before,
.help-tip:focus-visible::before {
  opacity: 1;
}

.help-tip:hover::after,
.help-tip:focus::after,
.help-tip:focus-visible::after {
  transform: translate(-50%, 0);
}

.help-tip:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--teal) 45%, transparent);
  outline-offset: 2px;
}

.topbar { margin-bottom: 22px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  line-height: 1.05;
}

h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.16;
}

h3 {
  margin: 0 0 16px;
  font-size: 1.05rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-action,
.ghost-action,
.download-link,
.icon-button {
  border: 0;
  min-height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.primary-action {
  padding: 0 15px;
  background: var(--teal);
  color: var(--surface);
}

.ghost-action,
.download-link {
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  background: var(--tint);
  color: var(--teal);
}

.icon-button {
  width: 42px;
  background: var(--tint);
  color: var(--ink);
  font-size: 1.2rem;
}

.icon-button.text-button {
  width: auto;
  padding: 0 14px;
  font-size: 0.95rem;
}

.hero-brief {
  min-height: 272px;
  display: grid;
  align-content: space-between;
  gap: 28px;
  padding: 28px;
  margin-bottom: 26px;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(90deg, rgba(17, 51, 57, 0.95), rgba(24, 110, 103, 0.75)),
    url("assets/care-journey.svg") center/cover no-repeat;
  box-shadow: var(--shadow);
}

.hero-copy {
  max-width: 780px;
}

.hero-copy h2 {
  margin: 14px 0 10px;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.98;
}

.hero-copy p {
  max-width: 660px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
  line-height: 1.5;
}

.status-pill,
.share-badge,
.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.status-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.32);
}

.share-badge {
  color: var(--blue);
  background: var(--tint);
}

.user-chip {
  color: var(--teal);
  background: var(--mint);
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.timeline-strip button {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 800;
  color: white;
  cursor: pointer;
}

.timeline-strip .done { background: rgba(217, 242, 229, 0.3); }
.timeline-strip .current { background: rgba(255, 255, 255, 0.92); color: var(--teal); }
.timeline-strip button:hover,
.timeline-strip button:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.timeline-strip .current:hover,
.timeline-strip .current:focus-visible {
  background: white;
}

.admin-detail-panel {
  padding: 0;
}

.admin-detail-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  cursor: pointer;
  list-style: none;
}

.admin-detail-panel > summary::-webkit-details-marker {
  display: none;
}

.admin-detail-panel > summary::after {
  content: "+";
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--tint);
  color: var(--blue);
  font-weight: 900;
}

.admin-detail-panel[open] > summary::after {
  content: "-";
}

.admin-detail-panel > summary h3 {
  margin: 0;
}

.admin-detail-panel > :not(summary) {
  margin-left: 18px;
  margin-right: 18px;
}

.admin-detail-actions {
  margin-top: 0;
}

.admin-detail-panel > :last-child {
  margin-bottom: 18px;
}

.view { display: none; }
.view.active { display: grid; gap: 20px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.appointment-card,
.claim-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(26, 48, 62, 0.06);
}

.metric-card {
  padding: 18px;
  min-height: 164px;
  border-top: 4px solid var(--teal);
}

.metric-card.alert { border-top-color: var(--coral); }
.metric-label { color: var(--muted); font-size: 0.82rem; font-weight: 850; }
.metric-card strong { display: block; margin: 10px 0; font-size: 1.75rem; }
.metric-card p, .panel p { margin: 0; color: var(--muted); line-height: 1.45; }

.content-grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel { padding: 20px; }

.snapshot-list { margin: 0; display: grid; gap: 14px; }
.snapshot-list div { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.snapshot-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.snapshot-list dt { color: var(--muted); font-size: 0.82rem; font-weight: 850; }
.snapshot-list dd { margin: 4px 0 0; line-height: 1.45; }

.task-list,
.family-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.care-task-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.care-contact-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.red-flag-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.red-flag-form .wide {
  grid-column: 1 / -1;
}

.safety-note {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--coral) 45%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--coral) 12%, var(--surface));
  color: var(--ink);
  font-weight: 750;
}

.care-contact-form .wide {
  grid-column: 1 / -1;
}

.family-invite-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 4px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.family-invite-form .wide {
  grid-column: 1 / -1;
}

.care-task-form .wide {
  grid-column: 1 / -1;
}

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

.care-task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
}

.care-task-item.done {
  opacity: 0.72;
}

.care-task-item.done strong {
  text-decoration: line-through;
}

.admin-checklist,
.admin-user-list {
  display: grid;
  gap: 12px;
}

.admin-check {
  display: grid;
  grid-template-columns: minmax(120px, 0.5fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--coral);
  border-radius: 8px;
  background: var(--raised);
}

.admin-check.ready {
  border-left-color: var(--teal);
}

.admin-check span {
  font-weight: 900;
  color: var(--muted);
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
}

.audit-event {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
}

.diagnostic-output {
  min-height: 120px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--ink);
  font-size: 0.9rem;
}

.admin-user-card > div:first-child {
  align-self: center;
}

.admin-actions {
  justify-content: flex-start;
}

.admin-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.task-list li,
.family-list li {
  padding: 12px;
  border-radius: 8px;
  background: var(--raised);
  border: 1px solid var(--line);
}

.regimen-list,
.log-list,
.question-list,
.appointment-list,
.claim-board,
.care-contact-list,
.red-flag-list,
.permission-list {
  display: grid;
  gap: 12px;
}

.regimen-item,
.log-item,
.question-item,
.care-contact-card,
.red-flag-card,
.permission-item {
  padding: 14px;
  border-radius: 8px;
  background: var(--raised);
  border: 1px solid var(--line);
}

.care-contact-card {
  border-left: 5px solid var(--blue);
}

.care-contact-card.urgent {
  border-left-color: var(--coral);
}

.red-flag-card {
  border-left: 5px solid var(--gold);
}

.red-flag-card.urgent {
  border-left-color: var(--coral);
}

.permission-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.invite-code {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.regimen-item strong,
.question-item strong,
.appointment-card strong,
.claim-card strong {
  display: block;
  margin-bottom: 5px;
}

.meta-line {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.entry-form,
.question-composer,
.document-form,
.appointment-form,
.claim-form,
.treatment-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.document-form,
.appointment-form,
.claim-form,
.treatment-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.document-form .wide,
.appointment-form .wide,
.claim-form .wide,
.treatment-form .wide {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions button {
  justify-self: end;
}

.question-composer {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.question-composer .wide {
  grid-column: 1 / -1;
}

.visit-prep-panel {
  display: grid;
  gap: 14px;
}

.treatment-timeline-panel {
  display: grid;
  gap: 14px;
}

.timeline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-filters button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
  padding: 0 10px;
}

.timeline-filters button.active {
  background: var(--mint);
  color: var(--ink);
}

.care-timeline {
  display: grid;
  gap: 10px;
}

.timeline-event {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: var(--raised);
}

.timeline-event.symptom { border-left-color: var(--coral); }
.timeline-event.visit { border-left-color: var(--blue); }
.timeline-event.record { border-left-color: var(--teal); }
.timeline-event.claim { border-left-color: var(--gold); }
.timeline-event.task { border-left-color: var(--muted); }

.timeline-date strong,
.timeline-date span {
  display: block;
}

.timeline-date span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.visit-prep-controls {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: end;
}

.visit-prep-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

#visitPrepPacket {
  min-height: 340px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--surface);
}

textarea { resize: vertical; line-height: 1.45; }

.appointment-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.date-block {
  border-left: 5px solid var(--blue);
  padding-left: 12px;
}

.date-block span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 850;
}

.document-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 0.65fr 0.7fr 0.55fr 1.2fr;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child { border-bottom: 0; }
.table-head { background: var(--table-head); color: var(--muted); font-weight: 900; font-size: 0.82rem; text-transform: uppercase; }

.table-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.empty-state {
  padding: 18px;
  color: var(--muted);
}

.file-link {
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
  padding: 0 10px;
}

.inline-actions {
  margin-top: 10px;
  justify-content: flex-start;
}

.claim-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.claim-card {
  padding: 18px;
  border-top: 4px solid var(--gold);
}

.claim-card.denied { border-top-color: var(--coral); }
.claim-card.approved { border-top-color: var(--teal); }

.claim-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 14px 0;
}

.claim-details div {
  min-width: 0;
}

.claim-details dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.claim-details dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.claim-file {
  margin-top: 10px;
}

.question-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.question-item button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.family-brief textarea {
  min-height: 260px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 44px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    min-height: 42vh;
    align-content: end;
  }
  .auth-video {
    width: min(720px, 100%);
  }
  .auth-card {
    align-self: start;
  }
  .onboarding-grid {
    grid-template-columns: 1fr;
  }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }
  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .admin-nav {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .admin-nav .nav-link {
    width: fit-content;
  }
  .privacy-note { display: none; }
  .metric-grid,
  .content-grid.two,
  .claim-board,
  .question-composer,
  .admin-check,
  .admin-user-card,
  .family-invite-form,
  .visit-prep-controls,
  .care-contact-form,
  .red-flag-form,
  .document-form,
  .appointment-form,
  .claim-form,
  .care-task-form,
  .treatment-form { grid-template-columns: 1fr; }
  .timeline-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appointment-card { grid-template-columns: 1fr; }
  .timeline-event { grid-template-columns: 1fr; }
  .visit-prep-actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
  body {
    font-size: 19px;
  }
  .workspace {
    padding: 16px 14px 96px;
  }
  .auth-screen {
    width: 100%;
    max-width: 100vw;
    background:
      linear-gradient(180deg, rgba(17, 51, 57, 0.96), rgba(24, 110, 103, 0.72)),
      url("assets/care-journey.svg") center/cover no-repeat;
  }
  .auth-hero {
    width: 100%;
    min-height: 34vh;
    padding: 22px;
    max-width: 100vw;
  }
  .auth-hero img {
    width: 52px;
    height: 52px;
    margin-bottom: 16px;
  }
  .auth-hero h1 {
    font-size: 3.1rem;
  }
  .auth-hero p:not(.eyebrow) {
    font-size: 1rem;
    width: calc(100vw - 44px);
    max-width: calc(100vw - 44px);
  }
  .auth-video {
    width: calc(100vw - 44px);
    max-width: calc(100vw - 44px);
    margin-top: 20px;
  }
  .auth-card {
    width: calc(100% - 28px);
    max-width: calc(100vw - 28px);
  }
  .auth-tabs {
    grid-template-columns: 1fr;
  }
  .plan-options {
    grid-template-columns: 1fr;
  }
  .family-access-screen {
    padding: 16px;
  }
  .onboarding-screen {
    padding: 12px;
  }
  .onboarding-card {
    max-height: calc(100vh - 24px);
    padding: 18px;
  }
  .onboarding-actions {
    flex-direction: column-reverse;
  }
  .brand {
    font-size: 1.22rem;
  }
  .brand img {
    width: 44px;
    height: 44px;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 15;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 10px 26px rgba(29, 54, 73, 0.10);
  }
  .nav-list {
    display: flex;
    gap: 10px;
    margin: 10px -14px 0;
    padding: 0 14px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .nav-link,
  .admin-nav .nav-link {
    flex: 0 0 auto;
    min-height: 54px;
    min-width: 132px;
    justify-content: center;
    padding: 0 16px;
    font-size: 1.08rem;
    scroll-snap-align: start;
  }
  .nav-link span {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
  .admin-nav {
    margin-top: 8px;
  }
  .admin-nav .nav-link {
    min-width: 118px;
    width: auto;
  }
  .topbar,
  .section-heading,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .heading-with-tip {
    align-items: flex-start;
    gap: 12px;
  }
  .help-tip {
    width: 38px;
    height: 38px;
    font-size: 1.08rem;
  }
  .help-tip::after {
    width: min(330px, calc(100vw - 40px));
    font-size: 1rem;
  }
  .help-tip::after {
    left: auto;
    right: 0;
    transform: translateY(6px);
  }
  .help-tip::before {
    left: auto;
    right: 10px;
    transform: rotate(45deg);
  }
  .help-tip:hover::after,
  .help-tip:focus::after,
  .help-tip:focus-visible::after {
    transform: translateY(0);
  }
  .eyebrow {
    font-size: 0.95rem;
  }
  h1 {
    font-size: clamp(2.25rem, 10vw, 3rem);
    line-height: 1.08;
  }
  h2 {
    font-size: 1.95rem;
    line-height: 1.12;
  }
  h3 {
    font-size: 1.28rem;
    line-height: 1.2;
  }
  .top-actions { width: 100%; }
  .primary-action,
  .ghost-action,
  .download-link {
    min-height: 54px;
    font-size: 1.1rem;
  }
  .primary-action,
  .ghost-action,
  .download-link,
  .icon-button.text-button {
    width: 100%;
    justify-content: center;
  }
  .top-actions .ghost-action,
  .top-actions .text-button,
  .user-chip {
    width: 100%;
    justify-content: center;
    max-width: none;
  }
  .status-pill,
  .share-badge,
  .user-chip {
    min-height: 42px;
    font-size: 1.02rem;
    white-space: normal;
  }
  .hero-brief {
    padding: 20px;
    min-height: auto;
    gap: 22px;
  }
  .hero-copy h2 {
    font-size: 2.05rem;
    line-height: 1.12;
  }
  .hero-copy p {
    font-size: 1.14rem;
    line-height: 1.55;
  }
  .timeline-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .timeline-strip button {
    min-height: 54px;
    font-size: 1.08rem;
  }
  .metric-card,
  .panel,
  .appointment-card,
  .claim-card {
    padding: 20px;
    border-radius: 8px;
  }
  .metric-label,
  .snapshot-list dt,
  label,
  .table-head,
  .claim-details dt {
    font-size: 1.02rem;
  }
  .metric-card strong {
    font-size: 1.9rem;
  }
  .metric-card p,
  .panel p,
  .meta-line,
  .snapshot-list dd,
  .claim-details dd {
    font-size: 1.1rem;
    line-height: 1.6;
  }
  input,
  select,
  textarea {
    min-height: 56px;
    padding: 14px;
    font-size: 1.12rem;
  }
  textarea {
    line-height: 1.5;
  }
  label {
    gap: 8px;
    line-height: 1.3;
  }
  .form-actions {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .form-actions button {
    width: 100%;
    justify-self: stretch;
  }
  .row-actions button,
  .question-item button,
  .timeline-filters button {
    min-height: 50px;
    font-size: 1.05rem;
  }
  .row-actions {
    width: 100%;
    justify-content: stretch;
  }
  .row-actions button {
    flex: 1 1 100%;
  }
  .table-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .care-task-item {
    grid-template-columns: 1fr;
  }
  .question-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .claim-details {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .visit-prep-actions,
  .timeline-filters {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  #visitPrepPacket {
    font-size: 1.02rem;
    line-height: 1.55;
  }
  .table-head { display: none; }
}

@media print {
  .sidebar,
  .top-actions,
  .section-heading button,
  .download-link,
  .question-composer,
  .toast { display: none !important; }
  .family-access-screen { padding: 0; }
  .app-shell { display: block; }
  .workspace { padding: 0; }
  .view { display: block !important; break-after: page; }
  .hero-brief { color: var(--ink); background: none; border: 1px solid var(--line); }
}
