:root {
  --bg: #f4eee2;
  --bg-deep: #ebe3d3;
  --surface: #fffdf8;
  --surface-soft: #faf6ed;
  --surface-mute: #f2ede3;
  --ink: #29342c;
  --ink-soft: #536057;
  --muted: #626c62;
  --line: rgba(55, 70, 57, 0.12);
  --line-strong: rgba(55, 70, 57, 0.2);
  --sage: #6c8971;
  --sage-deep: #405d49;
  --sage-dark: #304737;
  --sage-soft: #e8f0e5;
  --clay: #b76e51;
  --clay-deep: #8e4c37;
  --clay-soft: #f7e6dc;
  --gold: #bc8a3f;
  --gold-soft: #f6ecd8;
  --mist: #dfeae8;
  --alert: #984b3d;
  --alert-deep: #7d392e;
  --cream: #fff9ed;
  --shadow-soft: 0 24px 60px -40px rgba(45, 53, 37, 0.36);
  --shadow-card: 0 16px 40px -32px rgba(45, 53, 37, 0.36);
  --radius: 28px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html[data-font="large"] {
  font-size: 18px;
}

html[data-font="xlarge"] {
  font-size: 20px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 110px;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(ellipse 58% 42% at 94% 2%, rgba(206, 174, 121, 0.24), transparent 70%),
    radial-gradient(ellipse 46% 36% at 0% 22%, rgba(127, 153, 130, 0.16), transparent 70%),
    var(--bg);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

::selection {
  color: var(--cream);
  background: var(--sage-deep);
}

:focus-visible {
  outline: 3px solid var(--sage-deep);
  outline-offset: 3px;
  border-radius: 8px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 12px 18px;
  color: var(--cream);
  background: var(--sage-deep);
  border-radius: 12px;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 238, 226, 0.88);
  border-bottom: 1px solid rgba(55, 70, 57, 0.08);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 14px clamp(20px, 4vw, 48px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--cream);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.24), transparent 55%),
    var(--sage-deep);
  border-radius: 15px 15px 15px 6px;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 249, 237, 0.2);
  border-radius: 10px 10px 10px 3px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-text strong {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.main-nav a {
  padding: 10px 15px;
  color: var(--ink-soft);
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.main-nav a:hover {
  color: var(--ink);
  background: rgba(255, 253, 248, 0.68);
}

.main-nav a.is-active {
  color: var(--sage-deep);
  background: rgba(108, 137, 113, 0.14);
  font-weight: 600;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.weather {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  white-space: nowrap;
}

.weather .icon {
  color: var(--gold);
  font-size: 1.1rem;
}

.font-toggle,
.sos-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.font-toggle {
  background: rgba(255, 253, 248, 0.7);
}

.font-toggle:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.font-toggle-icon {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.font-toggle-icon span {
  margin-left: 1px;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 700;
}

.sos-mini {
  color: var(--cream);
  background: var(--alert);
  border-color: transparent;
  box-shadow: 0 8px 20px -12px rgba(152, 75, 61, 0.62);
}

.sos-mini:hover {
  background: var(--alert-deep);
  transform: translateY(-1px);
}

/* ---------- Layout ---------- */

main > section,
.site-footer {
  width: min(100%, 1320px);
  margin-right: auto;
  margin-left: auto;
  padding-right: clamp(20px, 4vw, 48px);
  padding-left: clamp(20px, 4vw, 48px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow > span:first-child {
  width: 20px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 56px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button .icon {
  font-size: 1.08rem;
}

.button-primary {
  color: var(--cream);
  background: var(--sage-deep);
  box-shadow: 0 14px 28px -16px rgba(48, 71, 55, 0.56);
}

.button-primary:hover {
  background: var(--sage-dark);
  box-shadow: 0 18px 34px -16px rgba(48, 71, 55, 0.6);
}

.button-ghost {
  color: var(--ink);
  background: rgba(255, 253, 248, 0.42);
  border-color: var(--line);
}

.button-ghost:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.button-soft {
  color: var(--sage-deep);
  background: var(--sage-soft);
  border-color: transparent;
}

.button-soft:hover {
  background: #dce8d9;
}

.button-danger {
  color: var(--cream);
  background: var(--alert);
}

.button-danger:hover {
  background: var(--alert-deep);
}

.button-block {
  width: 100%;
}

.button-ghost-light {
  color: var(--cream);
  background: transparent;
  border-color: rgba(255, 249, 237, 0.3);
}

.button-ghost-light:hover {
  background: rgba(255, 249, 237, 0.1);
  border-color: rgba(255, 249, 237, 0.5);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow-x: hidden;
  overflow-x: clip;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.82fr);
  align-items: center;
  gap: clamp(36px, 6vw, 88px);
  padding-top: clamp(48px, 6.5vw, 84px);
  padding-bottom: clamp(66px, 8vw, 104px);
}

.hero-ambient {
  position: absolute;
  top: -10%;
  left: -14%;
  z-index: -1;
  width: 780px;
  height: 780px;
  background: radial-gradient(circle, rgba(108, 137, 113, 0.14), transparent 64%);
  pointer-events: none;
}

.date-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.live-dot {
  position: relative;
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--sage);
  border-radius: 50%;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid var(--sage);
  border-radius: 50%;
  opacity: 0.36;
  animation: softPulse 2.6s ease-out infinite;
}

.hero h1 {
  max-width: 760px;
  margin-top: 24px;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 5.2vw, 4.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.14;
}

.hero h1 em {
  position: relative;
  z-index: 0;
  color: var(--sage-deep);
  font-style: normal;
  white-space: nowrap;
}

.hero h1 em::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: 4px;
  left: -2px;
  z-index: -1;
  height: 0.28em;
  background: linear-gradient(90deg, rgba(200, 178, 129, 0.4), rgba(200, 178, 129, 0.12));
  border-radius: 999px;
  transform: rotate(-1.4deg);
}

.hero-lead {
  max-width: 540px;
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.95;
}

.mood-check {
  max-width: 540px;
  margin-top: 30px;
  padding: 18px 20px 15px;
  background: rgba(255, 253, 248, 0.62);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mood-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mood-head > span {
  font-size: 0.96rem;
  font-weight: 600;
}

.mood-head small {
  color: var(--muted);
  font-size: 0.78rem;
}

.mood-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mood {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 76px;
  padding: 9px 6px 8px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid var(--line);
  border-radius: 17px;
  font-size: 0.84rem;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mood svg {
  width: 33px;
  height: 33px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mood:hover {
  color: var(--sage-deep);
  border-color: rgba(108, 137, 113, 0.4);
  transform: translateY(-2px);
}

.mood[aria-pressed="true"] {
  color: var(--sage-deep);
  background: var(--sage-soft);
  border-color: rgba(108, 137, 113, 0.58);
  box-shadow: inset 0 0 0 1px rgba(108, 137, 113, 0.08);
}

.mood-response {
  min-height: 1.5em;
  margin-top: 9px;
  padding-left: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  transition: color 0.2s ease;
}

.mood-response.has-response {
  color: var(--sage-deep);
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.8rem;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trust-row .icon {
  color: var(--sage);
  font-size: 1rem;
}

.hero-visual {
  position: relative;
  align-self: center;
}

.portrait-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin-left: auto;
}

.portrait-wrap::before {
  content: "";
  position: absolute;
  top: -36px;
  right: -36px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(108, 137, 113, 0.18);
  border-radius: 50%;
  pointer-events: none;
}

.portrait-card {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #d9d0be;
  border-radius: 36px 36px 36px 14px;
  box-shadow: 0 32px 70px -44px rgba(41, 52, 44, 0.55);
}

.portrait-card > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.portrait-card:hover > img {
  transform: scale(1.025);
}

.portrait-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(31, 38, 31, 0.86) 0%, rgba(31, 38, 31, 0.28) 30%, transparent 58%);
  pointer-events: none;
}

.online-pill {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  color: #3b5442;
  background: rgba(255, 251, 242, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 0.78rem;
  font-weight: 600;
}

.online-pill > span {
  width: 6px;
  height: 6px;
  background: var(--sage);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(108, 137, 113, 0.18);
}

.photo-message {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px 12px 13px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  color: var(--ink);
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.avatar-sm {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}

.avatar-clay {
  color: #7e4431;
  background: #f0d6c9;
}

.avatar-gold {
  color: #7e5b23;
  background: #f3e3c3;
}

.avatar-sage {
  color: #3f5d48;
  background: #dfeadc;
}

.avatar-red {
  color: #fff7ef;
  background: #a95546;
  font-size: 0.72rem;
  letter-spacing: -0.03em;
}

.photo-message .avatar {
  width: 38px;
  height: 38px;
  background: rgba(255, 249, 237, 0.9);
  font-size: 0.95rem;
}

.photo-message-copy {
  flex: 1;
  min-width: 0;
}

.photo-message-copy strong {
  display: block;
  margin-bottom: 2px;
  color: rgba(255, 249, 237, 0.82);
  font-size: 0.74rem;
  font-weight: 500;
}

.photo-message-copy q {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-style: normal;
  line-height: 1.55;
}

.round-audio {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
}

.round-audio:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: scale(1.04);
}

.round-audio .icon {
  font-size: 1rem;
}

.reminder-float {
  position: absolute;
  bottom: 94px;
  left: -54px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 268px;
  padding: 12px 14px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow: 0 20px 46px -28px rgba(42, 50, 37, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.reminder-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--clay-deep);
  background: var(--clay-soft);
  border-radius: 12px;
}

.reminder-float small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.reminder-float strong {
  display: block;
  margin-top: 1px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
}

.photo-caption {
  margin: 14px 6px 0 0;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-align: right;
}

/* ---------- Health ---------- */

.health-section {
  padding-bottom: clamp(72px, 9vw, 112px);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.section-head h2 {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.34;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-bottom: 6px;
  padding: 10px 14px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.sync-dot {
  width: 6px;
  height: 6px;
  background: var(--sage);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(108, 137, 113, 0.16);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  align-items: start;
  gap: 24px;
}

.dashboard-main,
.dashboard-side {
  display: grid;
  gap: 24px;
}

.card {
  padding: clamp(20px, 2.4vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-head h3 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.35;
}

.card-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.status-pill,
.care-count,
.progress-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill {
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.status-pill > span {
  width: 6px;
  height: 6px;
  background: var(--sage);
  border-radius: 50%;
}

.care-count {
  color: var(--clay-deep);
  background: var(--clay-soft);
}

.progress-count {
  min-width: 48px;
  justify-content: center;
  color: var(--sage-deep);
  background: var(--sage-soft);
  font-variant-numeric: tabular-nums;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.metric {
  position: relative;
  min-width: 0;
  min-height: 144px;
  padding: 17px 17px 15px;
  background: var(--surface-soft);
  border: 1px solid rgba(55, 70, 57, 0.07);
  border-radius: 20px;
}

.metric-wide {
  background:
    radial-gradient(circle at 95% 10%, rgba(108, 137, 113, 0.14), transparent 42%),
    linear-gradient(145deg, #f1f6ef, #fbf8f0);
  border-color: rgba(108, 137, 113, 0.16);
}

.metric-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 12px;
}

.metric-icon .icon {
  font-size: 1.05rem;
}

.icon-sage {
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.icon-clay {
  color: var(--clay-deep);
  background: var(--clay-soft);
}

.icon-gold {
  color: #81612a;
  background: var(--gold-soft);
}

.icon-mist {
  color: #44645e;
  background: var(--mist);
}

.metric-label {
  flex: 1;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.metric-label small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 400;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.metric-value strong {
  font-size: clamp(2.1rem, 3vw, 2.65rem);
  font-weight: 500;
  letter-spacing: -0.045em;
}

.metric-value > span {
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 400;
}

.metric-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.76rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.tag-good {
  color: #40664b;
  background: #e4efe1;
}

.sparkline {
  width: 92px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: var(--sage);
  stroke-width: 1.8;
  stroke-linecap: round;
  opacity: 0.75;
}

.mini-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
}

.mini-bars i {
  display: block;
  width: 3px;
  background: rgba(183, 110, 81, 0.5);
  border-radius: 2px;
}

.mini-bars i:nth-child(1) { height: 9px; }
.mini-bars i:nth-child(2) { height: 15px; }
.mini-bars i:nth-child(3) { height: 6px; }
.mini-bars i:nth-child(4) { height: 12px; }
.mini-bars i:nth-child(5) { height: 17px; }

.sleep-quality {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sleep-quality i {
  width: 9px;
  height: 5px;
  background: rgba(188, 138, 63, 0.26);
  border-radius: 2px;
}

.sleep-quality i:first-child,
.sleep-quality i:nth-child(2) {
  background: rgba(188, 138, 63, 0.64);
}

.health-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 13px 14px;
  background: #f5f8f1;
  border: 1px solid rgba(108, 137, 113, 0.1);
  border-radius: 16px;
}

.note-spark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  color: var(--sage-deep);
  background: rgba(255, 253, 248, 0.78);
  border-radius: 50%;
}

.health-note p {
  flex: 1;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.7;
}

.health-note p strong {
  color: var(--sage-deep);
  font-weight: 600;
}

.measure-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 8px 10px;
  color: var(--sage-deep);
  background: transparent;
  border: 1px solid rgba(108, 137, 113, 0.22);
  border-radius: 999px;
  font-size: 0.76rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.measure-btn:hover {
  background: var(--surface);
  border-color: rgba(108, 137, 113, 0.4);
}

.measure-btn .icon {
  font-size: 0.95rem;
}

.measure-btn.is-measuring .icon {
  animation: spin 0.9s linear infinite;
}

/* ---------- Chart ---------- */

.trend-head {
  align-items: center;
}

.chart-tabs {
  display: inline-flex;
  gap: 2px;
  flex: none;
  padding: 4px;
  background: var(--surface-mute);
  border-radius: 999px;
}

.chart-tabs button {
  min-width: 62px;
  padding: 9px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chart-tabs button:hover {
  color: var(--ink);
}

.chart-tabs button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 3px 10px -6px rgba(45, 53, 37, 0.4);
  font-weight: 600;
}

.chart-wrap {
  position: relative;
  margin-top: 10px;
}

.chart-legend {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  min-height: 20px;
  padding: 2px 4px 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
}

.legend-sage { background: var(--sage); }
.legend-clay { background: var(--clay); }

.trend-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 4px;
  overflow: visible;
}

.chart-grid {
  stroke: rgba(55, 70, 57, 0.09);
  stroke-width: 1;
}

.chart-target {
  stroke: rgba(108, 137, 113, 0.18);
  stroke-width: 1;
  stroke-dasharray: 3 6;
}

.chart-axis {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
}

.chart-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: chartDraw 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.chart-line-primary { stroke: var(--sage); }
.chart-line-secondary { stroke: var(--clay); stroke-width: 2; stroke-dasharray: 4 5; animation: none; }
.chart-line-single { stroke: var(--sage); }

.chart-area { opacity: 0.55; }

.chart-dot {
  fill: var(--surface);
  stroke: var(--sage);
  stroke-width: 2.5;
  transition: r 0.2s ease;
}

.chart-dot-secondary {
  fill: var(--surface);
  stroke: var(--clay);
  stroke-width: 2;
}

.chart-column {
  fill: rgba(108, 137, 113, 0.22);
  transition: fill 0.2s ease;
}

.chart-column.is-accent {
  fill: var(--sage);
}

.chart-column:hover {
  fill: rgba(108, 137, 113, 0.4);
}

.chart-value {
  fill: var(--ink);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
}

.chart-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 11px 14px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.6;
}

.chart-summary .icon {
  color: var(--sage);
  font-size: 1.05rem;
}

.chart-summary strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Medicine ---------- */

.progress-track {
  width: 100%;
  height: 5px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--surface-mute);
  border-radius: 999px;
}

.progress-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--sage), #8aa68c);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.medicine-list {
  margin-top: 10px;
}

.medicine-item {
  display: grid;
  grid-template-columns: 42px 1px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 11px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}

.medicine-item:last-child {
  border-bottom: 0;
}

.medicine-item time {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.medicine-line {
  width: 1px;
  height: 32px;
  background: var(--line);
}

.medicine-item.is-taken .medicine-line {
  background: rgba(108, 137, 113, 0.5);
}

.medicine-copy {
  min-width: 0;
}

.medicine-copy strong {
  display: block;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.medicine-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.medicine-item.is-taken .medicine-copy strong {
  color: var(--muted);
}

.take-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--line-strong);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.take-btn:hover {
  color: var(--sage-deep);
  border-color: var(--sage);
  transform: scale(1.03);
}

.take-btn .icon {
  font-size: 1.05rem;
  stroke-width: 2.2;
}

.medicine-item.is-taken .take-btn {
  color: var(--cream);
  background: var(--sage-deep);
  border-color: var(--sage-deep);
}

.medicine-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.medicine-foot .icon {
  color: var(--sage);
  font-size: 0.95rem;
}

/* ---------- Family ---------- */

.family-list {
  margin-top: 10px;
}

.family-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}

.family-list li:last-child {
  border-bottom: 0;
}

.family-copy {
  flex: 1;
  min-width: 0;
}

.family-copy strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.family-copy strong small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}

.family-copy > span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-action {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  color: var(--sage-deep);
  background: var(--sage-soft);
  border: 1px solid transparent;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
}

.family-action:hover {
  background: #dce8d9;
  transform: scale(1.04);
}

.family-action.voice {
  color: #7e5b23;
  background: var(--gold-soft);
}

.family-action.voice:hover {
  background: #f0e2c6;
}

.family-message {
  margin-top: 8px;
  padding: 13px 14px;
  background: linear-gradient(145deg, #faf4e9, #fdf9f2);
  border: 1px solid rgba(183, 110, 81, 0.1);
  border-radius: 16px;
}

.wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.wave i {
  width: 3px;
  height: 5px;
  background: rgba(183, 110, 81, 0.48);
  border-radius: 999px;
}

.wave i:nth-child(2) { height: 10px; }
.wave i:nth-child(3) { height: 15px; }
.wave i:nth-child(4) { height: 8px; }
.wave i:nth-child(5) { height: 13px; }
.wave i:nth-child(6) { height: 6px; }
.wave i:nth-child(7) { height: 14px; }
.wave i:nth-child(8) { height: 9px; }
.wave i:nth-child(9) { height: 12px; }
.wave i:nth-child(10) { height: 5px; }

.wave.is-playing i {
  animation: wavePlay 0.75s ease-in-out infinite alternate;
}

.wave.is-playing i:nth-child(2n) {
  animation-delay: 0.18s;
}

.wave.is-playing i:nth-child(3n) {
  animation-delay: 0.32s;
}

.family-message p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: 0.88rem;
  line-height: 1.65;
}

.family-message > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.family-card .button-block {
  margin-top: 13px;
}

/* ---------- Companion banner ---------- */

.companion-banner {
  position: relative;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: center;
  gap: clamp(26px, 5vw, 70px);
  margin-top: 6px;
  margin-bottom: clamp(56px, 7vw, 84px);
  padding-top: clamp(36px, 5vw, 60px);
  padding-bottom: clamp(36px, 5vw, 60px);
  overflow: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 10% 20%, rgba(205, 184, 143, 0.24), transparent 34%),
    radial-gradient(circle at 88% 86%, rgba(137, 164, 140, 0.28), transparent 38%),
    var(--sage-deep);
  border-radius: 36px 36px 36px 14px;
  box-shadow: 0 30px 80px -48px rgba(45, 65, 49, 0.8);
}

.companion-banner::before,
.companion-banner::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 249, 237, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.companion-banner::before {
  top: -150px;
  right: -80px;
  width: 360px;
  height: 360px;
}

.companion-banner::after {
  bottom: -230px;
  left: 30%;
  width: 420px;
  height: 420px;
}

.companion-visual {
  position: relative;
  display: grid;
  place-items: center;
}

.orb {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, #f8ecd4 0%, #e1d2b2 27%, #b1c0a8 62%, #7d9a80 100%);
  box-shadow:
    inset 0 0 30px rgba(255, 255, 255, 0.42),
    0 24px 54px -20px rgba(14, 31, 18, 0.55);
}

.orb-large {
  width: clamp(138px, 14vw, 178px);
  height: clamp(138px, 14vw, 178px);
}

.orb-core {
  position: absolute;
  top: 22%;
  left: 23%;
  width: 34%;
  height: 28%;
  background: rgba(255, 252, 244, 0.86);
  border-radius: 50%;
  filter: blur(8px);
}

.orb-ring {
  position: absolute;
  border: 1px solid rgba(255, 249, 237, 0.19);
  border-radius: 50%;
  pointer-events: none;
}

.orb-ring-one {
  inset: -18px;
  animation: breathe 5.2s ease-in-out infinite;
}

.orb-ring-two {
  inset: -38px;
  border-color: rgba(255, 249, 237, 0.09);
  animation: breathe 5.2s 1.4s ease-in-out infinite;
}

.orb-small {
  width: 44px;
  height: 44px;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.4);
}

.orb-small .orb-core {
  filter: blur(4px);
}

.companion-copy {
  position: relative;
  z-index: 1;
}

.companion-copy .eyebrow {
  color: rgba(255, 249, 237, 0.58);
}

.companion-copy h2 {
  max-width: 780px;
  margin-top: 14px;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.1vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.companion-copy > p {
  max-width: 620px;
  margin-top: 14px;
  color: rgba(255, 249, 237, 0.78);
  font-size: 0.95rem;
  line-height: 1.8;
}

.companion-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.companion-banner .button-primary {
  color: var(--sage-dark);
  background: var(--cream);
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.45);
}

.companion-banner .button-primary:hover {
  background: #ffffff;
}

/* ---------- Footer ---------- */

.site-footer {
  padding-top: 28px;
  padding-bottom: 54px;
  border-top: 1px solid var(--line);
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

.brand-footer .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px 13px 13px 5px;
  font-size: 1.25rem;
}

.brand-footer .brand-text strong {
  font-size: 1.22rem;
}

.footer-top > p {
  max-width: 600px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.8;
  text-align: right;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding-top: 18px;
  color: var(--muted);
  border-top: 1px solid rgba(55, 70, 57, 0.08);
  font-size: 0.76rem;
}

/* ---------- SOS floating ---------- */

.sos-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 9px;
  color: var(--cream);
  background: var(--alert);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  box-shadow: 0 18px 38px -18px rgba(125, 57, 46, 0.72);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.sos-fab::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(152, 75, 61, 0.25);
  border-radius: inherit;
  animation: sosRing 3s ease-out infinite;
  pointer-events: none;
}

.sos-fab:hover {
  background: var(--alert-deep);
  transform: translateY(-2px);
  box-shadow: 0 22px 44px -18px rgba(125, 57, 46, 0.8);
}

.sos-fab-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
}

.sos-fab-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.3;
}

.sos-fab-copy strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.sos-fab-copy small {
  color: rgba(255, 249, 237, 0.7);
  font-size: 0.62rem;
}

/* ---------- Overlay / Chat ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(34, 42, 34, 0.38);
  opacity: 0;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: opacity 0.25s ease;
}

.scrim.is-visible {
  opacity: 1;
}

.chat-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 32px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 40px 100px -30px rgba(29, 40, 31, 0.52);
  transform: translateX(calc(100% + 32px));
  transition: transform 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chat-panel.is-open {
  transform: translateX(0);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf8, #fbf7ef);
}

.chat-head-main {
  display: flex;
  align-items: center;
  gap: 11px;
}

.chat-head h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
}

.chat-head p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.7rem;
}

.chat-tool:hover {
  background: var(--surface-mute);
}

.chat-tool[aria-pressed="true"] {
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.chat-tool .icon {
  font-size: 0.95rem;
}

.chat-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--ink-soft);
  background: var(--surface-mute);
  border: 0;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.chat-close:hover {
  background: #e9e2d5;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  background:
    radial-gradient(circle at 86% 4%, rgba(108, 137, 113, 0.07), transparent 36%),
    var(--surface);
  overscroll-behavior: contain;
}

.chat-body::-webkit-scrollbar {
  width: 5px;
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(55, 70, 57, 0.16);
  border-radius: 999px;
}

.chat-day {
  margin: 2px 0 16px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
}

.message-user {
  justify-content: flex-end;
}

.msg-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  color: var(--cream);
  background: var(--sage-deep);
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: 0.82rem;
}

.msg-content {
  max-width: 84%;
}

.message-user .msg-content {
  max-width: 78%;
}

.bubble {
  padding: 12px 15px;
  color: var(--ink);
  background: #f4efe4;
  border-radius: 4px 18px 18px 18px;
  font-size: 0.96rem;
  line-height: 1.75;
  word-break: break-word;
}

.message-user .bubble {
  color: var(--cream);
  background: var(--sage-deep);
  border-radius: 18px 4px 18px 18px;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  padding-left: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.speak-btn {
  padding: 0;
  color: var(--sage-deep);
  background: transparent;
  border: 0;
  font-size: 0.72rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 52px;
  min-height: 42px;
}

.typing i {
  width: 6px;
  height: 6px;
  background: rgba(64, 93, 73, 0.42);
  border-radius: 50%;
  animation: typing 1.1s ease-in-out infinite;
}

.typing i:nth-child(2) { animation-delay: 0.16s; }
.typing i:nth-child(3) { animation-delay: 0.32s; }

.chat-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  scrollbar-width: none;
}

.chat-suggestions::-webkit-scrollbar {
  display: none;
}

.chat-suggestions button {
  flex: none;
  padding: 10px 13px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.chat-suggestions button:hover {
  background: var(--sage-soft);
  border-color: rgba(108, 137, 113, 0.3);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px 4px;
}

.composer-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
}

.mic-btn {
  color: var(--sage-deep);
  background: var(--sage-soft);
  border: 1px solid transparent;
}

.mic-btn:hover,
.mic-btn.is-listening {
  background: #dce8d9;
}

.mic-btn.is-listening {
  color: var(--alert);
  animation: micPulse 1.4s ease-in-out infinite;
}

.send-btn {
  color: var(--cream);
  background: var(--sage-deep);
  border: 0;
}

.send-btn:hover {
  background: var(--sage-dark);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 15px;
  font-size: 0.96rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.chat-form input:focus {
  background: var(--surface);
  border-color: rgba(108, 137, 113, 0.55);
}

.chat-form input::placeholder {
  color: #777f76;
}

.chat-disclaimer {
  padding: 4px 16px 12px;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

/* ---------- Modals ---------- */

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 80;
  width: min(470px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 30px;
  box-shadow: 0 40px 100px -30px rgba(29, 40, 31, 0.55);
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.97);
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal.is-open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--ink-soft);
  background: var(--surface-mute);
  border: 0;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: #e9e2d5;
}

.modal .eyebrow {
  margin-top: 4px;
}

.modal h2 {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.35;
}

.modal-lead {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.call-modal {
  text-align: center;
}

.call-avatar {
  width: 92px;
  height: 92px;
  margin: 4px auto 18px;
  border: 6px solid rgba(255, 253, 248, 0.7);
  box-shadow: 0 18px 38px -18px rgba(126, 68, 49, 0.42);
  font-size: 2rem;
}

.call-modal .eyebrow {
  justify-content: center;
}

.call-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.call-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  margin: 20px 0 24px;
}

.call-wave i {
  width: 4px;
  height: 8px;
  background: rgba(108, 137, 113, 0.45);
  border-radius: 999px;
  animation: callWave 1s ease-in-out infinite alternate;
}

.call-wave i:nth-child(2) { animation-delay: 0.1s; }
.call-wave i:nth-child(3) { animation-delay: 0.22s; }
.call-wave i:nth-child(4) { animation-delay: 0.06s; }
.call-wave i:nth-child(5) { animation-delay: 0.3s; }
.call-wave i:nth-child(6) { animation-delay: 0.15s; }
.call-wave i:nth-child(7) { animation-delay: 0.4s; }
.call-wave i:nth-child(8) { animation-delay: 0.24s; }
.call-wave i:nth-child(9) { animation-delay: 0.08s; }

.call-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.call-actions .button {
  min-width: 132px;
  min-height: 52px;
}

.sos-modal h2 {
  margin-top: 6px;
}

.sos-mark,
.message-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  color: var(--cream);
  background: var(--alert);
  border-radius: 18px 18px 18px 6px;
}

.message-mark {
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.sos-modal .sos-mark {
  background: var(--alert);
}

.sos-options {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.sos-contact {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 17px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sos-contact:hover {
  background: var(--surface);
  border-color: rgba(108, 137, 113, 0.36);
  transform: translateY(-1px);
}

.sos-contact > .icon {
  margin-left: auto;
  color: var(--sage-deep);
  font-size: 1.1rem;
}

.sos-contact-copy {
  flex: 1;
  min-width: 0;
}

.sos-contact-copy strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
}

.sos-contact-copy small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.76rem;
}

.sos-contact-urgent {
  background: var(--clay-soft);
  border-color: rgba(183, 110, 81, 0.18);
}

.sos-contact-urgent:hover {
  background: #f8e1d4;
  border-color: rgba(183, 110, 81, 0.38);
}

.sos-contact-urgent > .icon {
  color: var(--clay-deep);
}

.sos-hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.sos-calling {
  padding: 28px 0 10px;
  text-align: center;
}

.calling-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  color: var(--cream);
  background: var(--sage-deep);
  border-radius: 50%;
}

.calling-ring span {
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(108, 137, 113, 0.35);
  border-radius: 50%;
  animation: calling 2s ease-out infinite;
}

.calling-ring span:nth-child(2) {
  animation-delay: 0.6s;
}

.calling-ring span:nth-child(3) {
  animation-delay: 1.2s;
}

.calling-ring .icon {
  font-size: 1.35rem;
}

.sos-calling h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.sos-calling h3 span {
  color: var(--sage-deep);
}

.sos-calling p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8rem;
}

.sos-calling .button {
  margin-top: 20px;
  min-height: 48px;
}

.message-modal textarea {
  width: 100%;
  min-height: 124px;
  margin-top: 20px;
  padding: 14px 15px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.7;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.message-modal textarea:focus {
  background: var(--surface);
  border-color: rgba(108, 137, 113, 0.55);
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.message-actions .button {
  min-height: 50px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  z-index: 120;
  max-width: calc(100vw - 40px);
  padding: 13px 20px;
  color: var(--cream);
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 18px 40px -20px rgba(30, 39, 31, 0.7);
  font-size: 0.82rem;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Motion ---------- */

@keyframes softPulse {
  0% { transform: scale(0.7); opacity: 0.5; }
  75%, 100% { transform: scale(1.5); opacity: 0; }
}

@keyframes breathe {
  0%, 100% { transform: scale(0.98); opacity: 0.4; }
  50% { transform: scale(1.035); opacity: 0.75; }
}

@keyframes sosRing {
  0% { transform: scale(1); opacity: 0.55; }
  70%, 100% { transform: scale(1.08); opacity: 0; }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@keyframes wavePlay {
  from { transform: scaleY(0.4); }
  to { transform: scaleY(1.25); }
}

@keyframes callWave {
  from { height: 7px; opacity: 0.45; }
  to { height: 26px; opacity: 1; }
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(152, 75, 61, 0.24); }
  50% { box-shadow: 0 0 0 8px rgba(152, 75, 61, 0.06); }
}

@keyframes calling {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes chartDraw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .header-inner {
    gap: 14px;
  }

  .main-nav a {
    padding: 9px 11px;
  }

  .weather {
    display: none;
  }

  .hero {
    grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
    gap: 44px;
  }

  .reminder-float {
    left: -28px;
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
    padding-top: 50px;
  }

  .hero-copy {
    max-width: 720px;
  }

  .hero-visual {
    width: 100%;
  }

  .portrait-wrap {
    max-width: 640px;
    margin: 0 auto;
  }

  .portrait-card {
    aspect-ratio: 16 / 11;
    border-radius: 30px 30px 30px 12px;
  }

  .portrait-card > img {
    object-position: center 30%;
  }

  .reminder-float {
    right: 20px;
    bottom: 84px;
    left: auto;
  }

  .photo-caption {
    text-align: center;
  }

  .dashboard {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .dashboard-side .card {
    height: 100%;
  }

  .companion-banner {
    grid-template-columns: 150px minmax(0, 1fr);
  }
}

@media (max-width: 780px) {
  html {
    scroll-padding-top: 24px;
  }

  .site-header {
    position: relative;
  }

  .header-inner {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 8px;
    row-gap: 6px;
  }

  .brand-text small {
    display: none;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding: 2px 0 3px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .main-nav a {
    flex: none;
    padding: 8px 14px;
    font-size: 0.86rem;
  }

  .header-tools {
    margin-left: auto;
  }

  .font-toggle span:last-child,
  .sos-mini span {
    display: none;
  }

  .font-toggle,
  .sos-mini {
    width: 44px;
    padding: 0;
  }

  .hero h1 {
    font-size: clamp(2.75rem, 11vw, 3.6rem);
  }

  .hero-lead {
    font-size: 0.98rem;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .sync-chip {
    margin-bottom: 0;
  }

  .trend-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-tabs {
    width: 100%;
  }

  .chart-tabs button {
    flex: 1;
  }

  .dashboard-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .companion-banner {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    text-align: center;
  }

  .companion-visual {
    order: 2;
    margin-top: 4px;
  }

  .companion-copy .eyebrow,
  .companion-actions {
    justify-content: center;
  }

  .companion-copy > p {
    margin-right: auto;
    margin-left: auto;
  }

  .companion-copy h2 {
    font-size: 1.7rem;
  }

  .footer-top {
    flex-direction: column;
    gap: 20px;
  }

  .footer-top > p {
    text-align: left;
  }

  .chat-panel {
    inset: 0;
    width: 100%;
    border: 0;
    border-radius: 0;
  }

  .sos-fab {
    right: 16px;
    bottom: 16px;
  }

  .toast {
    bottom: 92px;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-bottom: 64px;
  }

  .mood-check {
    padding: 15px 14px 12px;
  }

  .mood-options {
    gap: 6px;
  }

  .mood {
    min-height: 70px;
    padding: 7px 3px 6px;
    font-size: 0.71rem;
  }

  .mood svg {
    width: 29px;
    height: 29px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .button {
    width: 100%;
  }

  .trust-row {
    gap: 8px 14px;
  }

  .portrait-card {
    aspect-ratio: 4 / 5;
  }

  .photo-message {
    right: 10px;
    bottom: 10px;
    left: 10px;
    padding: 10px;
  }

  .photo-message-copy q {
    font-size: 0.84rem;
  }

  .reminder-float {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: auto;
    margin: 12px 0 0;
  }

  .metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric {
    min-height: 132px;
  }

  .health-note {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .health-note p {
    flex-basis: calc(100% - 46px);
  }

  .measure-btn {
    width: 100%;
    justify-content: center;
    margin-left: 44px;
  }

  .chart-legend {
    justify-content: flex-start;
    padding-left: 0;
  }

  .medicine-item {
    grid-template-columns: 38px 1px minmax(0, 1fr) 40px;
    gap: 8px;
  }

  .medicine-copy strong {
    white-space: normal;
  }

  .companion-banner {
    border-radius: 28px 28px 28px 10px;
    padding-right: 22px;
    padding-left: 22px;
  }

  .companion-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .companion-actions .button {
    width: 100%;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 6px;
  }

  .sos-fab {
    padding-right: 15px;
  }

  .sos-fab-copy small {
    display: none;
  }

  .modal {
    padding: 26px 20px 22px;
    border-radius: 24px;
  }

  .message-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .message-actions .button {
    width: 100%;
  }

  .call-actions .button {
    min-width: 0;
    flex: 1;
  }

  .chat-tool span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .chart-line {
    stroke-dasharray: none !important;
  }
}
