/* ==========================================================================
   Synmed Connect — Outreach to Outcome
   Shares the SynMedCare design language (tokens mirror staff-app/styles.css).
   Field-first: white cards on deep forest for outdoor readability, large
   touch targets, bottom navigation in the thumb zone.
   ========================================================================== */
:root {
  --forest-950: #021d0b;
  --forest-900: #073902;
  --forest-800: #0b4b18;
  --forest-700: #166702;
  --green-600: #24a148;
  --green-500: #35b85b;
  --lime-200: #e2f0c6;
  --lime-100: #f1f7e6;
  --ivory: #fbfaf5;
  --paper: #ffffff;
  --ink: #071b10;
  --muted: #657369;
  --line: #e4e9e2;
  --soft: #f4f7f2;
  --coral: #e47a5f;
  --amber: #e8a740;
  --danger: #c84a4a;
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 34px;
  --shadow-soft: 0 18px 45px rgba(2, 29, 11, 0.1);
  --shadow-deep: 0 38px 90px rgba(0, 18, 6, 0.28);
  /* Premium light theme (post-login app + forms) */
  --app-bg: #eef2ea;
  --field-bg: #f5f8f3;
  --field-border: #e3e9e0;
  --ring: 0 0 0 4px rgba(36, 161, 72, 0.16);
  --shadow-card: 0 1px 2px rgba(2, 29, 11, 0.05), 0 10px 26px -8px rgba(2, 29, 11, 0.12);
  --shadow-pop: 0 2px 6px rgba(2, 29, 11, 0.06), 0 22px 48px -14px rgba(2, 29, 11, 0.22);
  --ease: 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-width: 320px;
  background: var(--forest-950);
}

body {
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(53, 184, 91, 0.18), transparent 24rem),
    radial-gradient(circle at 92% 84%, rgba(226, 240, 198, 0.12), transparent 28rem),
    linear-gradient(145deg, #073902 0%, #03270e 58%, #021b0a 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

/* The hidden attribute must always win, even over display:flex classes. */
[hidden] {
  display: none !important;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(226, 240, 198, 0.75);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

.ambient-one {
  width: 30rem;
  height: 30rem;
  top: -12rem;
  right: -10rem;
  background: rgba(53, 184, 91, 0.16);
}

.ambient-two {
  width: 26rem;
  height: 26rem;
  bottom: -10rem;
  left: -10rem;
  background: rgba(226, 240, 198, 0.1);
}

/* ---------- icon strokes (hero art keeps its own inline paints) ---------- */
button svg,
.lp-trust svg,
.lp-step-icon svg,
.lp-feature-icon svg,
.tile-icon svg,
.empty-icon svg,
.login-help svg,
.check-list svg,
.profile-hint svg,
.secure-badge svg,
.back-link svg,
.input-shell svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- screens ---------- */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.screen.active {
  display: block;
  animation: rise 340ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- shared bits ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.brand img {
  height: 30px;
  width: auto;
  display: block;
}

.brand.small img {
  height: 24px;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: rgba(226, 240, 198, 0.35);
}

.brand-sub {
  color: var(--lime-200);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--forest-700);
}

.eyebrow.light {
  color: var(--lime-200);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 4px rgba(53, 184, 91, 0.25);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--forest-700);
  margin: 1.6rem 0 0.7rem;
}

.screen-title {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.screen-sub {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-top: 0.4rem;
}

.card {
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem;
}

/* ---------- buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 52px;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--green-500), var(--forest-700));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 14px 30px rgba(36, 161, 72, 0.35);
  transition: transform var(--ease), box-shadow var(--ease), filter var(--ease);
}

.btn-primary svg { width: 18px; height: 18px; }

.btn-primary:hover { filter: brightness(1.06); }

.btn-primary:active { transform: scale(0.98); }

.btn-primary:disabled {
  filter: saturate(0.4) brightness(0.9);
  cursor: default;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: rgba(226, 240, 198, 0.08);
  border: 1px solid rgba(226, 240, 198, 0.3);
  color: var(--lime-100);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--ease);
}

.ghost-btn svg { width: 16px; height: 16px; }

.ghost-btn:hover { background: rgba(226, 240, 198, 0.16); }

.btn-danger-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 50px;
  margin-top: 1rem;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  background: rgba(200, 74, 74, 0.08);
  border: 1px solid rgba(200, 74, 74, 0.35);
  color: var(--danger);
  font-weight: 700;
  transition: background var(--ease);
}

.btn-danger-ghost svg { width: 18px; height: 18px; }

.btn-danger-ghost:hover { background: rgba(200, 74, 74, 0.14); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  background: none;
  color: var(--lime-200);
  font-weight: 600;
  font-size: 0.9rem;
}

.back-link svg { width: 16px; height: 16px; }

/* ==========================================================================
   LANDING (premium — mirrors the SynMedCare marketing site)
   ========================================================================== */
.lp-hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}
.lp-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  z-index: -2;
}
.lp-hero-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(2,22,9,0.82) 0%, rgba(2,22,9,0.32) 34%, rgba(2,22,9,0.55) 60%, rgba(2,22,9,0.97) 100%),
    radial-gradient(120% 78% at 85% 8%, rgba(53,184,91,0.28), transparent 60%);
}
.lp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 1.1rem) 1.4rem 0;
}
.lp-hero-inner {
  max-width: 1180px;
  width: 100%;
  margin: auto auto 0;
  padding: 2.4rem 1.4rem 8.5rem;
}
.lp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--lime-200);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.42rem 0.9rem;
  border: 1px solid rgba(226, 240, 198, 0.28);
  border-radius: 999px;
  background: rgba(2, 22, 9, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lp-title {
  color: var(--ivory);
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 1.1rem 0;
  max-width: 16ch;
  text-shadow: 0 2px 34px rgba(0, 0, 0, 0.38);
}
.lp-title em { font-style: normal; color: var(--lime-200); }
.lp-lede {
  color: rgba(241, 247, 230, 0.9);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.65;
  max-width: 46ch;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.32);
}
.lp-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  margin-top: 1.8rem;
}
.lp-cta-btn { min-height: 54px; padding: 0.9rem 1.7rem; font-size: 1.02rem; }
.lp-cta-note { color: rgba(226, 240, 198, 0.72); font-size: 0.82rem; font-weight: 600; }
.lp-trust {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.5rem;
  margin-top: 1.9rem;
}
.lp-trust li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(241, 247, 230, 0.82);
  font-size: 0.85rem;
  font-weight: 600;
}
.lp-trust svg { width: 17px; height: 17px; color: var(--green-500); }

/* floating glass stat card — overlaps the hero base (pull-up motif) */
.lp-statcard {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.4rem;
  max-width: 640px;
  width: calc(100% - 2.8rem);
  margin: -5.5rem auto 0;
  padding: 1.15rem 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(226, 240, 198, 0.25);
  border-radius: var(--radius-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-deep);
}
.lp-stat { flex: 1; text-align: center; padding: 0.2rem 0.35rem; }
.lp-stat strong {
  display: block;
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  font-weight: 800;
  color: var(--lime-100);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.lp-stat small {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.3;
  color: rgba(226, 240, 198, 0.78);
}
.lp-stat-div { width: 1px; background: rgba(226, 240, 198, 0.2); flex: none; }

/* journey */
.lp-journey {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.6rem 1.4rem 1rem;
  text-align: center;
}
.lp-kicker {
  display: inline-block;
  color: var(--green-500);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.lp-heading {
  color: var(--ivory);
  font-size: clamp(1.5rem, 4.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0.6rem auto 0;
  max-width: 20ch;
}
.lp-steps {
  list-style: none;
  counter-reset: lp;
  display: grid;
  gap: 0.9rem;
  margin-top: 2rem;
  text-align: left;
}
.lp-steps li {
  position: relative;
  background: rgba(226, 240, 198, 0.06);
  border: 1px solid rgba(226, 240, 198, 0.16);
  border-radius: var(--radius-md);
  padding: 1.3rem;
}
.lp-steps li::after {
  counter-increment: lp;
  content: "0" counter(lp);
  position: absolute;
  top: 1.1rem;
  right: 1.3rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(226, 240, 198, 0.4);
}
.lp-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(53, 184, 91, 0.28), rgba(22, 103, 2, 0.28));
  color: var(--green-500);
  margin-bottom: 0.8rem;
}
.lp-step-icon svg { width: 22px; height: 22px; }
.lp-steps strong { display: block; color: var(--ivory); font-size: 1.05rem; font-weight: 800; }
.lp-steps p { color: rgba(241, 247, 230, 0.7); font-size: 0.88rem; line-height: 1.55; margin-top: 0.35rem; }

/* feature bands */
.lp-features {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.lp-feature {
  display: grid;
  gap: 0;
  background: var(--paper);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-deep);
}
.lp-feature-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
/* <picture> wraps the img for the WebP source; it must fill the frame or the
   img's height:100% would resolve against a collapsed inline box. */
.lp-feature-media picture { display: block; width: 100%; height: 100%; }
.lp-feature-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 600ms var(--ease);
}
.lp-feature:hover .lp-feature-media img { transform: scale(1.04); }
.lp-feature-copy { padding: 1.5rem 1.6rem 1.9rem; }
.lp-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--lime-100);
  color: var(--forest-700);
  margin-bottom: 0.9rem;
}
.lp-feature-icon svg { width: 23px; height: 23px; }
.lp-feature-copy h3 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.lp-feature-copy p { color: var(--muted); font-size: 0.95rem; line-height: 1.65; margin-top: 0.5rem; }

/* CTA strip */
.lp-cta-strip {
  max-width: 1180px;
  margin: 1.4rem auto 0;
  padding: 3rem 1.4rem 3.2rem;
  text-align: center;
}
.lp-cta-strip .lp-cta-btn { margin-top: 1.4rem; }

/* footer */
.lp-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.6rem 1.4rem calc(env(safe-area-inset-bottom, 0px) + 2rem);
  border-top: 1px solid rgba(226, 240, 198, 0.12);
  color: rgba(226, 240, 198, 0.6);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}
.lp-footer-meta { color: rgba(226, 240, 198, 0.55); }

.secure-badge { display: inline-flex; align-items: center; gap: 0.4rem; }
.secure-badge svg { width: 15px; height: 15px; }

/* desktop */
@media (min-width: 860px) {
  .lp-hero-inner { padding-bottom: 9rem; }
  .lp-steps { grid-template-columns: repeat(4, 1fr); }
  .lp-feature { grid-template-columns: 1fr 1fr; align-items: center; }
  .lp-feature-media { aspect-ratio: auto; height: 100%; min-height: 340px; }
  .lp-feature.reverse .lp-feature-media { order: 2; }
  .lp-feature-copy { padding: 2.6rem; }
  .lp-footer { flex-direction: row; justify-content: space-between; }
}

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-wrap {
  max-width: 430px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 1.2rem) 1.2rem calc(env(safe-area-inset-bottom, 0px) + 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 100dvh;
  justify-content: center;
}

.login-card {
  padding: 1.9rem 1.6rem;
}

.login-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--forest-900);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.1rem;
}

.login-mark svg { width: 38px; height: 38px; }

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.4rem;
}

.field > span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--forest-800);
  margin-bottom: 0.4rem;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  padding: 0 1rem;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}

.input-shell:focus-within {
  border-color: var(--green-600);
  background: #fff;
  box-shadow: var(--ring);
}

.input-shell svg {
  width: 18px;
  height: 18px;
  color: var(--green-600);
  opacity: 0.85;
}

.input-shell input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  border: 0;
  background: none;
  outline: none;
  font-size: 1rem;
  color: var(--ink);
}

.input-shell input::placeholder { color: var(--muted); opacity: 0.75; }

.form-error {
  background: rgba(200, 74, 74, 0.1);
  border: 1px solid rgba(200, 74, 74, 0.35);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
}

.login-help {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.login-help svg {
  width: 17px;
  height: 17px;
  margin-top: 0.1rem;
  color: var(--green-600);
}

/* ==========================================================================
   APP SHELL  —  premium light theme (chrome stays branded forest)
   ========================================================================== */
#screen-app {
  background: var(--app-bg);
  min-height: 100dvh;
}

.app-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(env(safe-area-inset-top, 0px) + 0.8rem) 1.2rem 0.8rem;
  background: linear-gradient(180deg, var(--forest-900), var(--forest-800));
  border-bottom: 1px solid rgba(2, 29, 11, 0.12);
  box-shadow: 0 6px 20px -10px rgba(2, 29, 11, 0.5);
}

.net-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.net-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.net-pill.online {
  color: var(--lime-100);
  background: rgba(53, 184, 91, 0.16);
  border-color: rgba(53, 184, 91, 0.4);
}

.net-pill.online .dot { background: var(--green-500); }

.net-pill.offline {
  color: #fbe4c9;
  background: rgba(232, 167, 64, 0.16);
  border-color: rgba(232, 167, 64, 0.45);
}

.net-pill.offline .dot { background: var(--amber); }

.app-body {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.2rem 1.2rem calc(env(safe-area-inset-bottom, 0px) + 110px);
}

.tab { display: none; }

.tab.active {
  display: block;
  animation: rise 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.greet-card .screen-title { margin-top: 0.35rem; }

/* toolkit tiles */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-height: 118px;
  text-align: left;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1rem 0.9rem;
  transition: transform var(--ease), box-shadow var(--ease);
}

.tile:active { transform: scale(0.97); }

.tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--lime-100);
  color: var(--forest-700);
  margin-bottom: 0.45rem;
}

.tile-icon svg { width: 19px; height: 19px; }

.tile-icon.big {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}

.tile-icon.big svg { width: 26px; height: 26px; }

.tile strong {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.25;
}

.tile small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.soon-chip {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest-700);
  background: var(--lime-200);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
}

/* getting started */
.start-card { margin-top: 1.2rem; }

/* section-label sits on dark elsewhere; inside white cards it needs ink. */
.card .section-label { color: var(--forest-800); }

.check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.check-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.check-list svg {
  width: 19px;
  height: 19px;
  color: var(--green-600);
}

.check-list li.pending { color: var(--muted); }

.check-list li.pending svg { color: var(--amber); }

/* empty states */
.empty-state {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 2.6rem 1.6rem;
  text-align: center;
  color: var(--ink);
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--lime-100);
  color: var(--forest-700);
  margin-bottom: 1rem;
}

.empty-icon svg { width: 26px; height: 26px; }

.empty-state h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
}

.empty-state p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-top: 0.5rem;
  max-width: 26rem;
  margin-inline: auto;
}

/* profile */
.profile-card { margin-bottom: 0.9rem; }

.profile-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

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

.profile-row span { color: var(--muted); font-weight: 600; }

.profile-row strong {
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}

.profile-hint {
  display: flex;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.profile-hint svg {
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  color: var(--green-600);
}

.version-note {
  text-align: center;
  color: var(--muted);
  opacity: 0.7;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 1.4rem;
}

/* bottom tab bar — thumb zone, safe-area aware */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: space-around;
  background: rgba(4, 34, 13, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(226, 240, 198, 0.14);
  padding: 0.45rem 0.4rem calc(env(safe-area-inset-bottom, 0px) + 0.45rem);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  max-width: 120px;
  min-height: 56px;
  padding: 0.4rem 0.2rem;
  border-radius: 14px;
  background: none;
  color: rgba(226, 240, 198, 0.55);
  font-size: 0.68rem;
  font-weight: 700;
  transition: color var(--ease), background var(--ease);
}

.tab-btn svg { width: 22px; height: 22px; }

.tab-btn.active {
  color: var(--lime-100);
  background: rgba(53, 184, 91, 0.16);
}

/* ---------- bottom sheet (must sit ABOVE the full-screen view layer, z-12,
   so editors opened from the client record aren't hidden behind it) ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 16;
  background: rgba(2, 22, 9, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 17;
  max-width: 560px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: var(--shadow-deep);
  padding: 0.9rem 1.5rem calc(env(safe-area-inset-bottom, 0px) + 1.4rem);
  text-align: center;
  animation: sheet-up 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sheet-grab {
  display: block;
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto 1.1rem;
}

.sheet .tile-icon { margin: 0 auto 0.8rem; }

.sheet h2 {
  font-size: 1.15rem;
  font-weight: 800;
}

.sheet p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.5rem auto 1.2rem;
  max-width: 26rem;
}

.sheet .btn-primary { width: 100%; }

/* ---------- toast & busy ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  transform: translate(-50%, 20px);
  z-index: 20;
  background: var(--forest-950);
  color: var(--lime-100);
  border: 1px solid rgba(226, 240, 198, 0.25);
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease), transform var(--ease);
  max-width: min(92vw, 30rem);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.err {
  border-color: rgba(200, 74, 74, 0.6);
  color: #f3b9b9;
}

.busy {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  background: rgba(2, 22, 9, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--lime-100);
  font-weight: 600;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3.5px solid rgba(226, 240, 198, 0.25);
  border-top-color: var(--green-500);
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   CLIENTS TAB — list, search
   ========================================================================== */
.clients-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.6rem 0 0.7rem;
}

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--green-500), var(--forest-700));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 10px 22px rgba(36, 161, 72, 0.32);
  transition: transform var(--ease), filter var(--ease);
}

.btn-mini svg { width: 15px; height: 15px; }
.btn-mini:active { transform: scale(0.96); }

.search-shell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(226, 240, 198, 0.08);
  border: 1px solid rgba(226, 240, 198, 0.22);
  border-radius: var(--radius-sm);
  padding: 0 0.9rem;
  margin-bottom: 0.9rem;
  transition: border-color var(--ease), background var(--ease);
}

.search-shell:focus-within {
  border-color: var(--green-500);
  background: rgba(226, 240, 198, 0.12);
}

.search-shell svg { width: 17px; height: 17px; color: var(--lime-200); }

.search-shell input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  border: 0;
  background: none;
  outline: none;
  color: var(--ivory);
  font-size: 0.95rem;
}

.search-shell input::placeholder { color: rgba(226, 240, 198, 0.5); }

.client-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.list-loading,
.list-empty {
  color: rgba(241, 247, 230, 0.6);
  font-size: 0.88rem;
  text-align: center;
  padding: 2rem 1rem;
  line-height: 1.55;
}

.client-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.85rem 0.95rem;
  transition: transform var(--ease);
}

.client-row:active { transform: scale(0.98); }

.client-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  background: var(--lime-100);
  color: var(--forest-700);
  font-weight: 800;
  font-size: 0.95rem;
}

.client-row-main { flex: 1; min-width: 0; }

.client-row-name {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-row-sub {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-row-chev { color: var(--line); flex: none; }
.client-row-chev svg { width: 18px; height: 18px; }

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9a6a12;
  background: rgba(232, 167, 64, 0.18);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  margin-left: 0.4rem;
  vertical-align: 1px;
}

.sync-chip svg { width: 11px; height: 11px; }

/* ==========================================================================
   FULL-SCREEN VIEW LAYER (intake · client record · consent)
   ========================================================================== */
.view-layer {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: var(--app-bg);
}

.view {
  display: none;
  flex-direction: column;
  height: 100dvh;
  max-width: 620px;
  margin: 0 auto;
  background: var(--app-bg);
}

.view.active {
  display: flex;
  animation: view-in 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes view-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

.view-top {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: calc(env(safe-area-inset-top, 0px) + 0.9rem) 1.1rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}

.icon-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--forest-800);
  transition: background var(--ease);
}

.icon-back:active { background: var(--lime-100); }
.icon-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.view-eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest-700);
}

.view-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  word-break: break-word;
}

.view-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.2rem 1.1rem calc(env(safe-area-inset-bottom, 0px) + 1.4rem);
}

.view-foot {
  padding: 0.85rem 1.1rem calc(env(safe-area-inset-bottom, 0px) + 0.9rem);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 28px -16px rgba(2, 29, 11, 0.28);
}

.view-foot .btn-primary { width: 100%; }

/* ---------- forms inside views ---------- */
.form-note {
  display: flex;
  gap: 0.6rem;
  background: var(--lime-100);
  border: 1px solid var(--lime-200);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  color: var(--forest-800);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 1.3rem;
}

.form-note svg { width: 18px; height: 18px; flex: none; color: var(--green-600); margin-top: 0.05rem; }

.form-group {
  border: 0;
  margin-bottom: 1.4rem;
}

.form-group legend {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest-700);
  margin-bottom: 0.75rem;
  padding: 0;
}

.form-body .field { margin-bottom: 0.95rem; }

.form-body .field > span {
  color: var(--forest-800);
  font-size: 0.8rem;
  font-weight: 700;
}

.req {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 0.35rem;
}

/* Form inputs use the premium base .input-shell (light). Selects + textareas: */
.input-shell select { color: var(--ink); }

.input-shell.select { padding-right: 0.6rem; position: relative; }

.input-shell.select::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-left: -1.4rem;
  margin-top: -3px;
  pointer-events: none;
}

.input-shell select {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  border: 0;
  background: none;
  outline: none;
  font-size: 1rem;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1rem;
}

.input-shell select option { color: #111; }

.area {
  width: 100%;
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  color: var(--ink);
  padding: 0.8rem 0.95rem;
  font-size: 1rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}

.area::placeholder { color: var(--muted); opacity: 0.75; }
.area:focus { border-color: var(--green-600); background: #fff; box-shadow: var(--ring); }

/* ---------- client record ---------- */
.record-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lime-100);
  background: rgba(53, 184, 91, 0.18);
  border: 1px solid rgba(53, 184, 91, 0.4);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

.record-card {
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 0.4rem 1.1rem;
  margin-bottom: 1rem;
}

.record-card-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest-700);
  padding: 0.9rem 0 0.3rem;
}

.record-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.record-row:last-child { border-bottom: 0; }
.record-row .k { color: var(--muted); font-weight: 600; flex: none; max-width: 45%; }
.record-row .v { text-align: right; font-weight: 600; color: var(--ink); word-break: break-word; }
.record-row .v.empty { color: var(--line); font-weight: 500; }

/* consent checklist on the record */
.consent-list { display: flex; flex-direction: column; gap: 0.55rem; }

.consent-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.8rem 0.95rem;
  transition: transform var(--ease);
}

.consent-row:active { transform: scale(0.98); }

.consent-tick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--soft);
  color: var(--muted);
}

.consent-tick svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.consent-row.signed .consent-tick { background: rgba(36, 161, 72, 0.15); color: var(--green-600); }

.consent-row-main { flex: 1; min-width: 0; }
.consent-row-title { display: block; font-weight: 700; font-size: 0.86rem; color: var(--ink); }
.consent-row-sub { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 0.12rem; }
.consent-row.signed .consent-row-sub { color: var(--green-600); font-weight: 600; }

/* ---------- consent sign / review ---------- */
.consent-doc {
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem 1.2rem;
  margin-bottom: 1.1rem;
}

.consent-doc h3 { font-size: 1.05rem; font-weight: 800; color: var(--ink); }
.consent-doc .ver { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; margin-bottom: 0.8rem; }
.consent-doc p { font-size: 0.86rem; line-height: 1.65; color: #2a3a30; margin-bottom: 0.7rem; }
.consent-doc p:last-child { margin-bottom: 0; }

.sig-block { margin-bottom: 1.1rem; }

.sig-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--forest-800);
  margin-bottom: 0.5rem;
}

.sig-clear {
  background: none;
  color: var(--green-600);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: underline;
  padding: 0.3rem 0.2rem;
}

.sig-pad-wrap {
  position: relative;
  background: #fff;
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sig-pad-wrap.filled { border-color: var(--green-500); }

#sigPad { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; }

.sig-guide {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 2.4rem;
  border-bottom: 1.5px dashed #c7d3c1;
  pointer-events: none;
}

.sig-guide-x {
  position: absolute;
  left: 1rem;
  bottom: 2.5rem;
  color: #a9b7a3;
  font-size: 1.1rem;
  pointer-events: none;
}

.sig-hint { font-size: 0.76rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.5; }

.sig-review-img {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.signed-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(36, 161, 72, 0.15);
  border: 1px solid rgba(36, 161, 72, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  color: var(--lime-100);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 1.1rem;
}

.signed-banner svg { width: 20px; height: 20px; flex: none; color: var(--green-500); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* section heading inside record for consents */
.record-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest-700);
  margin: 1.4rem 0 0.7rem;
}

/* ==========================================================================
   PHASE 3 — assessment, SDOH screening, care plan
   ========================================================================== */

/* actions on the client record (run assessment / screening) */
.record-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.record-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.9rem 0.95rem;
  transition: transform var(--ease);
}

.record-action:active { transform: scale(0.97); }

.record-action .ra-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--lime-100);
  color: var(--forest-700);
  margin-bottom: 0.35rem;
}

.record-action .ra-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.record-action strong { font-size: 0.85rem; font-weight: 800; color: var(--ink); }
.record-action small { font-size: 0.72rem; color: var(--muted); }
.record-action.done .ra-icon { background: rgba(36, 161, 72, 0.15); color: var(--green-600); }
.record-action.done small { color: var(--green-600); font-weight: 600; }

/* segmented control (SDOH level + item status) */
.seg {
  display: flex;
  gap: 0.3rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.25rem;
}

.item-sheet .seg { background: var(--soft); }

.seg-btn {
  flex: 1;
  min-height: 42px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  transition: background var(--ease), color var(--ease);
}

.view-body .seg-btn { color: var(--muted); }

.seg-btn.active {
  background: linear-gradient(135deg, var(--green-500), var(--forest-700));
  color: #fff;
  box-shadow: 0 6px 16px rgba(36, 161, 72, 0.3);
}

.seg-btn.urgent.active {
  background: linear-gradient(135deg, #ef8f6a, var(--danger));
  box-shadow: 0 6px 16px rgba(200, 74, 74, 0.32);
}

/* SDOH screening rows */
.sdoh-row {
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.6rem;
}

.sdoh-name {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 0.55rem;
}

.sdoh-row .seg { background: var(--soft); }
.sdoh-row .seg-btn { color: var(--muted); }

.sdoh-note {
  width: 100%;
  margin-top: 0.6rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
  outline: none;
}

.sdoh-note::placeholder { color: var(--muted); }
.sdoh-note:focus { border-color: var(--green-500); background: #fff; }
.sdoh-note[hidden] { display: none; }

/* care plan list on the record */
.careplan-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.6rem;
  border-left: 4px solid var(--green-500);
  transition: transform var(--ease);
}

.careplan-item:active { transform: scale(0.98); }
.careplan-item.urgent { border-left-color: var(--danger); }
.careplan-item.completed { border-left-color: var(--line); opacity: 0.72; }

.cp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.cp-need { font-weight: 800; font-size: 0.9rem; color: var(--ink); }

.cp-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  flex: none;
}

.cp-badge.open { background: rgba(53, 184, 91, 0.16); color: var(--forest-700); }
.cp-badge.in_progress { background: rgba(232, 167, 64, 0.2); color: #9a6a12; }
.cp-badge.completed { background: var(--soft); color: var(--muted); }

.cp-action { font-size: 0.83rem; color: #2a3a30; line-height: 1.45; }

.cp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.cp-meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.cp-meta svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cp-meta .overdue { color: var(--danger); font-weight: 700; }
.cp-urgent-tag { color: var(--danger); font-weight: 800; }
.cp-unmatched { color: #9a6a12; font-weight: 700; }

/* care-plan item edit sheet */
.item-sheet { text-align: left; }
.item-sheet h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 0.15rem; }
.item-sheet > p { color: var(--muted); font-size: 0.85rem; line-height: 1.5; margin-bottom: 1.1rem; }

.item-field { margin-bottom: 1rem; }

.item-field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--forest-800);
  margin-bottom: 0.4rem;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.4rem;
}

.item-actions .btn-primary { flex: 1; }

.btn-text-muted {
  background: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.8rem 0.4rem;
  min-height: 50px;
}

/* ==========================================================================
   PHASE 4 — home dashboard, task queue, referrals, progress notes
   ========================================================================== */

/* home stat tiles */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 1rem 0 0.4rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.9rem 0.5rem;
  transition: transform var(--ease);
}

.stat-tile:active { transform: scale(0.97); }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--forest-700); line-height: 1; }
.stat-tile.alert .stat-num { color: var(--danger); }
.stat-label { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-align: center; }

/* clock in/out card */
.clock-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  padding: 1rem 1.1rem;
}

.clock-info { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.clock-info strong { display: block; font-size: 0.92rem; font-weight: 800; color: var(--ink); }
.clock-info small { display: block; font-size: 0.74rem; color: var(--muted); }

.clock-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
}
.clock-card.on .clock-dot {
  background: var(--green-500);
  box-shadow: 0 0 0 4px rgba(53, 184, 91, 0.22);
}

.clock-btn {
  flex: none;
  min-height: 44px;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  background: linear-gradient(135deg, var(--green-500), var(--forest-700));
  color: #fff;
  box-shadow: 0 10px 22px rgba(36, 161, 72, 0.3);
  transition: transform var(--ease), filter var(--ease);
}
.clock-btn:active { transform: scale(0.97); }
.clock-btn:disabled { filter: saturate(0.4) brightness(0.95); }
.clock-card.on .clock-btn {
  background: rgba(200, 74, 74, 0.12);
  color: var(--danger);
  border: 1px solid rgba(200, 74, 74, 0.4);
  box-shadow: none;
}

/* home "up next" preview */
.upnext-card {
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1.1rem;
  margin-top: 0.9rem;
}

.upnext-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.upnext-head strong { font-size: 0.9rem; font-weight: 800; }
.upnext-head a { font-size: 0.76rem; font-weight: 700; color: var(--green-600); }

/* task queue groups */
.task-group-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--forest-700);
  margin: 1.2rem 0 0.6rem;
}

.task-group-label.danger { color: var(--danger); }

.task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.55rem;
  border-left: 4px solid var(--green-500);
  transition: transform var(--ease);
}

.task-item:active { transform: scale(0.98); }
.task-item.overdue { border-left-color: var(--danger); }
.task-item.done { opacity: 0.6; border-left-color: var(--line); }

.task-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--lime-100);
  color: var(--forest-700);
  flex: none;
}

.task-type svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.task-type.referral { background: rgba(228, 122, 95, 0.16); color: var(--coral); }
.task-type.task { background: rgba(36, 161, 72, 0.14); color: var(--green-600); }

.task-main { min-width: 0; flex: 1; }
.task-main-title { display: block; font-weight: 700; font-size: 0.86rem; color: var(--ink); }
.task-main-sub { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 0.1rem; }
.task-main-sub .overdue { color: var(--danger); font-weight: 700; }
.task-chev { color: var(--muted); flex: none; }
.task-chev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* generic list item on the client record (referrals, notes) */
.record-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.5rem;
  transition: transform var(--ease);
}

.record-item:active { transform: scale(0.98); }
.record-item-main { min-width: 0; flex: 1; }
.record-item-title { display: block; font-weight: 700; font-size: 0.85rem; color: var(--ink); }
.record-item-sub { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 0.1rem; }

.record-outcome {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  flex: none;
  background: rgba(232, 167, 64, 0.2);
  color: #9a6a12;
}

.record-outcome.connected, .record-outcome.completed { background: rgba(36, 161, 72, 0.16); color: var(--forest-700); }
.record-outcome.declined, .record-outcome.no-response { background: var(--soft); color: var(--muted); }

/* add-row button (log referral / add note) */
.add-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  justify-content: center;
  background: var(--lime-100);
  border: 1.5px dashed var(--green-500);
  color: var(--forest-700);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-weight: 800;
  font-size: 0.84rem;
  margin-bottom: 0.5rem;
  transition: background var(--ease);
}

.add-row:active { background: var(--lime-200); }
.add-row svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* progress-note read view (light) */
.note-read-block { margin-bottom: 1.1rem; }
.note-read-block .k {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--forest-700);
  margin-bottom: 0.25rem;
}
.note-read-block .v { font-size: 0.9rem; line-height: 1.55; color: var(--ink); white-space: pre-wrap; }
.note-read-block .v.empty { color: var(--muted); }
.note-sig-view {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.5rem;
  max-width: 240px;
}
.note-sig-view img { width: 100%; display: block; }
.note-addendum-tag {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber);
  background: rgba(232, 167, 64, 0.16);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.8rem;
}

/* ==========================================================================
   PHASE 6 — privacy auto-lock (PIN gate)
   ========================================================================== */
.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 12% 10%, rgba(53, 184, 91, 0.2), transparent 22rem),
    linear-gradient(150deg, #073902 0%, #03270e 60%, #021b0a 100%);
}

.pin-card {
  width: 100%;
  max-width: 340px;
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-deep);
  padding: 2rem 1.6rem;
  text-align: center;
}

.pin-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  background: var(--forest-900);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-mark svg { width: 28px; height: 28px; fill: none; stroke: var(--lime-200); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pin-card h2 { font-size: 1.2rem; font-weight: 800; }
.pin-card > p { color: var(--muted); font-size: 0.88rem; line-height: 1.5; margin: 0.4rem 0 1.3rem; }

.pin-input {
  width: 100%;
  min-height: 54px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.7rem;
  outline: none;
}

.pin-input::placeholder { letter-spacing: normal; font-size: 1rem; font-weight: 600; color: var(--muted); }
.pin-input:focus { border-color: var(--green-600); background: #fff; }

.pin-error {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.pin-gate.shake .pin-card { animation: pin-shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes pin-shake {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(5px); }
  50% { transform: translateX(-7px); }
}

.pin-card .btn-primary { width: 100%; margin-top: 0.3rem; }

.pin-signout {
  display: block;
  width: 100%;
  margin-top: 1rem;
  background: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
  padding: 0.6rem;
}

.pin-signout:hover { color: var(--danger); }

/* ---------- consent document sections (real Synmed forms) ---------- */
.consent-note {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.8rem;
}


.consent-h {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--forest-700);
  margin: 1rem 0 0.45rem;
}

.consent-ul { margin: 0 0 0.8rem 1.1rem; }
.consent-ul li { font-size: 0.85rem; line-height: 1.6; color: #2a3a30; margin-bottom: 0.25rem; }

.consent-inline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.7rem;
}

.consent-inline-k { font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.consent-inline-v { font-size: 0.85rem; font-weight: 700; color: var(--ink); text-align: right; }

.consent-checks { margin-bottom: 0.9rem; }

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  margin-bottom: 0.35rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink);
  cursor: pointer;
}

.consent-check input { margin-top: 0.15rem; width: 18px; height: 18px; accent-color: var(--green-600); flex: none; }
.consent-check:active { background: var(--lime-100); }

.consent-check.read { cursor: default; background: var(--soft); }
.consent-check.read.on { background: var(--lime-100); border-color: var(--lime-200); font-weight: 600; }
.consent-check.read:not(.on) { opacity: 0.55; }

.consent-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--green-600);
  font-size: 0.75rem;
  font-weight: 800;
  flex: none;
}

.consent-check.read.on .consent-box { border-color: var(--green-500); }

/* ---------- report client / request transfer ---------- */
.report-banner {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: rgba(232, 167, 64, 0.14);
  border: 1px solid rgba(232, 167, 64, 0.42);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.report-banner svg { width: 20px; height: 20px; flex: none; color: #b9821f; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 0.05rem; }
.report-banner strong { display: block; font-size: 0.85rem; font-weight: 800; color: #7a5410; }
.report-banner span { display: block; font-size: 0.78rem; color: #8a6a2a; line-height: 1.45; margin-top: 0.1rem; }

.report-client-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 50px;
  margin-top: 1.8rem;
  background: var(--paper);
  border: 1.5px solid rgba(200, 74, 74, 0.4);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.88rem;
  transition: background var(--ease);
}

.report-client-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.report-client-btn:active { background: rgba(200, 74, 74, 0.06); }
.report-hint { font-size: 0.74rem; color: var(--muted); text-align: center; margin: 0.5rem auto 0; max-width: 30rem; line-height: 1.5; }

.report-submit {
  background: linear-gradient(135deg, #ef8f6a, var(--danger));
  box-shadow: 0 14px 30px rgba(200, 74, 74, 0.32);
}

/* ---------- face check (clock-in identity) ---------- */
.face-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(2, 22, 9, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.face-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 1.6rem 1.5rem calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  text-align: center;
}

.face-card h2 { font-size: 1.2rem; font-weight: 800; margin-top: 0.2rem; }
.face-card > p { color: var(--muted); font-size: 0.88rem; line-height: 1.5; margin: 0.4rem auto 1.2rem; max-width: 20rem; }

.face-cam-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 1.2rem;
  border-radius: 50%;
}

.face-cam-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #04220d;
  transform: scaleX(-1);   /* mirror — feels natural like a selfie */
}

.face-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 4px solid var(--line);
  pointer-events: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.face-ring.searching { border-color: var(--amber); }
.face-ring.ok { border-color: var(--green-500); box-shadow: 0 0 0 6px rgba(53, 184, 91, 0.18); }

.face-card .btn-primary { width: 100%; margin-top: 0.2rem; }
.face-card .btn-text-muted { width: 100%; margin-top: 0.4rem; }
.face-card .form-error { margin-bottom: 0.9rem; text-align: left; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
