:root {
  color-scheme: light;
  --bg: #f7f8f4;
  --ink: #17211c;
  --muted: #607064;
  --line: #d9ded5;
  --panel: #ffffff;
  --soft: #eef3e9;
  --brand: #176b5d;
  --brand-dark: #0d443b;
  --amber: #b76610;
  --red: #b3261e;
  --blue: #2459a6;
  --shadow: 0 18px 45px rgba(31, 45, 38, 0.1);
  --deep-shadow: 0 28px 80px rgba(23, 33, 28, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f7f8f4 0%, #ffffff 46%, #f3f6f0 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.skip-link {
  left: 1rem;
  padding: 0.75rem 1rem;
  position: absolute;
  top: -5rem;
  z-index: 10;
  background: var(--brand-dark);
  color: #fff;
  border-radius: 6px;
}

.skip-link:focus {
  top: 1rem;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(247, 248, 244, 0.86);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--brand-dark);
  font-weight: 950;
  text-decoration: none;
}

.brand-symbol {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links a {
  color: var(--muted);
  font-weight: 850;
  text-decoration: none;
}

.hero {
  min-height: min(720px, calc(100vh - 92px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  gap: 42px;
  align-items: center;
  position: relative;
  padding: 58px 0 76px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(247, 248, 244, 0.99) 0%, rgba(247, 248, 244, 0.9) 46%, rgba(247, 248, 244, 0.38) 100%),
    url("https://images.unsplash.com/photo-1584515933487-779824d29309?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
}

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

.hero-subtitle {
  color: #33453a;
  font-size: clamp(1.12rem, 1.7vw, 1.36rem);
  line-height: 1.45;
  max-width: 620px;
  margin: 18px 0 26px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.hero-proof span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(13, 68, 59, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #304238;
  font-size: 0.82rem;
  font-weight: 820;
  padding: 0 12px;
}

.product-preview {
  display: grid;
  gap: 14px;
  align-self: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  box-shadow: var(--deep-shadow);
  padding: 20px;
  backdrop-filter: blur(12px);
}

.preview-header,
.preview-score {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.preview-header {
  align-items: center;
  color: var(--muted);
  font-weight: 850;
}

.preview-header strong {
  background: #fff0d7;
  color: #7f4100;
  border-radius: 999px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
}

.preview-score {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.preview-score div {
  background: var(--soft);
  border-radius: 8px;
  min-height: 86px;
  padding: 12px;
}

.preview-score strong {
  display: block;
  font-size: 2rem;
}

.preview-score span,
.preview-task span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.preview-task {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
}

.preview-task.active {
  border-left: 5px solid var(--amber);
}

.preview-task strong,
.preview-task p {
  display: block;
  margin: 4px 0 0;
}

.value-band {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 34px;
  align-items: start;
  padding: 58px 0 34px;
}

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

.value-grid article {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-height: 168px;
  box-shadow: 0 12px 28px rgba(31, 45, 38, 0.06);
}

.value-grid p {
  color: var(--muted);
  margin-bottom: 0;
}

.story-band {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 34px;
  align-items: start;
  padding: 36px 0 56px;
}

.story-steps {
  display: grid;
  gap: 10px;
}

.story-steps article {
  display: grid;
  grid-template-columns: 54px minmax(0, 0.42fr) minmax(0, 0.58fr);
  gap: 14px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.story-steps span {
  color: var(--brand);
  font-weight: 950;
}

.story-steps p {
  color: var(--muted);
  margin-bottom: 0;
}

.topbar-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.workspace-subtitle {
  color: var(--muted);
  font-weight: 750;
  margin: 7px 0 0;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.connection-status.live {
  background: #dff0e6;
  color: #10533a;
}

.connection-status.error {
  background: #ffe3df;
  color: #8f1d16;
}

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

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

h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
  margin-bottom: 0;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.18;
  margin-bottom: 0;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.mode-switch {
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.mode-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  min-height: 42px;
  padding: 0 14px;
  font-weight: 800;
}

.mode-button.active {
  background: var(--brand);
  color: #fff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.care-grid,
.consent-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.status-panel,
.task-composer,
.full-band,
.patient-panel,
.consent-card,
.auth-panel,
.setup-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-panel,
.task-composer,
.patient-panel,
.consent-card,
.auth-panel,
.setup-panel {
  padding: 20px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  align-items: end;
  margin: 10px 0 28px;
}

.workspace-section {
  display: none;
  padding-top: 22px;
}

body.workspace-open .workspace-section {
  display: block;
}

body.signed-in .hero,
body.signed-in .value-band,
body.signed-in .story-band,
body.signed-in .auth-panel {
  display: none;
}

body.signed-in .marketing-nav-link {
  display: none;
}

body.signed-in .workspace-section {
  padding-top: 10px;
}

.workspace-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 18px 0;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.auth-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  flex-wrap: wrap;
}

.setup-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.setup-form,
.invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.invite-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

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

.empty-state {
  border: 1px dashed #bec8bd;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 18px;
}

.full-band {
  margin-top: 18px;
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.status-pill,
.priority-pill,
.kind-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.good {
  background: #dff0e6;
  color: #10533a;
}

.status-pill.watch {
  background: #fff0d7;
  color: #7f4100;
}

.status-pill.risk {
  background: #ffe3df;
  color: #8f1d16;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.score-row > div {
  background: var(--soft);
  border-radius: 8px;
  padding: 14px;
  min-height: 94px;
}

.score {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 900;
}

.score-label {
  color: var(--muted);
  display: block;
  font-weight: 750;
  margin-top: 6px;
}

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

.alert {
  border-left: 5px solid var(--amber);
  background: #fff8ed;
  border-radius: 6px;
  padding: 12px;
}

.alert.critical {
  border-color: var(--red);
  background: #fff2f0;
}

form {
  display: grid;
  gap: 12px;
}

label,
legend {
  color: var(--ink);
  display: grid;
  gap: 6px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c7cec5;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.recurrence-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.recurrence-options label,
.permission-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 750;
}

.recurrence-options input,
.permission-list input {
  width: 20px;
  min-height: 20px;
}

.voice-note-field {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf7;
  padding: 12px;
}

.media-field {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf7;
  padding: 12px;
}

.field-title {
  font-weight: 900;
  margin-bottom: 2px;
}

.voice-note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voice-note-player {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf7;
  padding: 10px;
}

.voice-note-player span {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.voice-note-player audio,
.voice-note-field audio {
  width: 100%;
}

.voice-note-player.unavailable {
  color: var(--muted);
  font-weight: 800;
}

.media-preview,
.media-card img {
  width: 100%;
  max-height: 260px;
  border-radius: 8px;
  object-fit: cover;
}

.media-card {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf7;
  padding: 10px;
}

.media-card figcaption {
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.media-card.unavailable {
  color: var(--muted);
  font-weight: 800;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.quiet-button {
  min-height: 48px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 900;
}

.primary-button {
  background: var(--brand);
  color: #fff;
  padding: 0 18px;
}

.secondary-button {
  background: #eff5f6;
  border-color: #c6d7dc;
  color: #173d48;
  padding: 0 18px;
}

.secondary-button.is-suggested {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 93, 0.16);
}

.primary-button.is-suggested {
  box-shadow: 0 0 0 3px rgba(23, 107, 93, 0.18);
}

.danger-button {
  background: #fff1ee;
  border-color: #efc7c0;
  color: #8f1d16;
  padding: 0 18px;
}

.quiet-button {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 0 18px;
}

.icon-button {
  aspect-ratio: 1;
  width: 44px;
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink);
  font-size: 1.4rem;
}

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

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

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.priority-pill.routine {
  background: #e5f0e8;
  color: #20523d;
}

.priority-pill.important {
  background: #fff0d7;
  color: #7f4100;
}

.priority-pill.critical {
  background: #ffe3df;
  color: #8f1d16;
}

.kind-pill {
  background: #e9eef8;
  color: #224b90;
}

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

.completion-photo-control {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  font-size: 0.82rem;
}

.completion-photo-control input {
  min-height: 36px;
  padding: 6px 0 0;
}

.patient-photo-control {
  text-align: left;
}

.patient-view {
  min-height: 64vh;
  display: none;
  place-items: center;
}

.patient-view.active {
  display: grid;
}

.patient-panel {
  width: min(760px, 100%);
  text-align: center;
}

.patient-task {
  display: grid;
  gap: 16px;
}

.patient-time {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 800;
}

.patient-instruction {
  font-size: clamp(1.55rem, 5vw, 2.7rem);
  line-height: 1.12;
  font-weight: 900;
  margin: 0;
}

.patient-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.patient-actions button {
  min-height: 78px;
}

.large-patient-text .patient-instruction {
  font-size: clamp(2rem, 7vw, 3.3rem);
}

.permission-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.small-copy {
  color: var(--muted);
  margin-bottom: 0;
}

.audit-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.audit-list li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}

@media (max-width: 820px) {
  .site-nav,
  .hero,
  .value-band,
  .story-band,
  .auth-panel,
  .care-grid,
  .consent-layout,
  .workspace-heading {
    grid-template-columns: 1fr;
    display: grid;
  }

  .site-nav {
    gap: 10px;
  }

  .nav-links {
    justify-content: space-between;
    width: 100%;
  }

  .hero {
    min-height: auto;
    padding: 36px 0 44px;
  }

  .hero::before {
    background:
      linear-gradient(180deg, rgba(247, 248, 244, 0.95), rgba(247, 248, 244, 0.74)),
      url("https://images.unsplash.com/photo-1584515933487-779824d29309?auto=format&fit=crop&w=1200&q=80");
    background-position: center;
    background-size: cover;
  }

  .value-grid,
  .preview-score,
  .story-steps article {
    grid-template-columns: 1fr;
  }

  .story-steps article {
    gap: 6px;
  }

  .topbar-actions {
    justify-items: stretch;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .setup-panel,
  .setup-form,
  .invite-form,
  .invite-item {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-button {
    flex: 1;
    padding: 0 8px;
  }

  .form-row,
  .score-row,
  .patient-actions {
    grid-template-columns: 1fr;
  }

  .recurrence-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-card {
    grid-template-columns: 1fr;
  }

  .task-actions {
    justify-content: stretch;
  }

  .task-actions button {
    flex: 1;
  }
}
