/* FamilyStork — mobile-first, works at 360px, 44px touch targets */
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/fonts/CormorantGaramond-var.woff2') format('woff2');
  font-weight: 500 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/HankenGrotesk-var.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap;
}

/* Palette & type: four values, two faces.
   ink #1B2029 · gold #B7935A · gold-on-dark #D2B183 · white #FFFFFF
   Cormorant Garamond (wordmark, headlines) · Hanken Grotesk (interface, body)
   Every tint below is an alpha of ink or gold — no fifth color. */
:root {
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --ink: #1B2029;
  --muted: rgba(27, 32, 41, 0.64);
  --line: rgba(27, 32, 41, 0.14);
  --accent: #B7935A;
  --accent-dark: #1B2029;
  --accent-soft: rgba(143, 108, 38, 0.10);
  --warm: #B7935A;
  --gold: #D2B183;
  --sage: #7FA98F;
  --amber: #B7935A;
  --danger: #B3271B;
  --danger-soft: #FBEDEC;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(27, 32, 41, 0.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  font-size: 16px;
}
h1, h2, h3, .brand, .brand-big { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; letter-spacing: 0; }
h1 { font-size: 1.8rem; margin: 0 0 .5rem; }
h2 { font-size: 1.35rem; margin: 0 0 .6rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.danger { color: var(--danger); }

.page { max-width: 860px; margin: 0 auto; padding: 16px 16px 64px; }
.page-title { margin-top: 12px; }
.crumbs { margin: 8px 0 0; font-size: .9rem; }
.crumbs a { text-decoration: none; color: var(--muted); }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-weight: 700; font-size: 1.1rem; color: var(--ink);
  text-decoration: none; letter-spacing: -0.01em;
}
.brand-mark { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 14px; }
.topnav a { text-decoration: none; color: var(--muted); padding: 10px 4px; min-height: 44px; display: inline-flex; align-items: center; }
.topnav a.on { color: var(--ink); font-weight: 600; }
.logout-form { display: inline; }

/* cards & forms */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
input, select, textarea {
  display: block; width: 100%;
  margin-top: 4px; padding: 11px 12px;
  font-size: 1rem; font-family: inherit;
  color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff;
  min-height: 44px;
}
textarea { min-height: 60px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.grid-form .form-error, .grid-form button, .grid-form .manual-note-field { grid-column: 1 / -1; }
@media (max-width: 480px) { .grid-form { grid-template-columns: 1fr; } }
.form-error { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin: 4px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px;
  font-size: 1rem; font-weight: 600; font-family: inherit;
  border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-danger-outline { border-color: var(--danger); color: var(--danger); background: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.linklike {
  background: none; border: none; padding: 10px 6px;
  color: var(--accent); font: inherit; cursor: pointer; min-height: 44px;
}
.linklike.danger { color: var(--danger); }

/* auth */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 48px 8px; }
.auth-hero { text-align: center; margin-bottom: 20px; }
.brand-big { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; }
.tagline { color: var(--muted); margin: 6px 0 0; }
.auth-card h1 { font-size: 1.2rem; }
.auth-switch { text-align: center; font-size: .9rem; color: var(--muted); }

/* persons grid */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 14px 0; }
.person-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; text-decoration: none; color: var(--ink);
}
.person-card:hover { border-color: var(--accent); }
.person-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: 0 0 64px;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; overflow: hidden;
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-card h3 { margin: 0; font-size: 1.05rem; }
.person-card p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }

/* person header */
.person-header { display: flex; gap: 16px; align-items: center; }
.person-photo {
  width: 84px; height: 84px; border-radius: 50%; flex: 0 0 84px;
  background: var(--accent-soft); overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
}
.person-photo img { width: 100%; height: 100%; object-fit: cover; }
.person-meta { min-width: 0; }
.person-meta p { margin: 0; }
.person-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
@media (max-width: 480px) {
  .person-header { flex-direction: column; text-align: center; }
  .person-actions { justify-content: center; }
}

/* upload */
.upload-zone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
#doc-status-list { margin-top: 8px; }
.doc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
  font-size: .92rem; min-height: 44px;
}
.doc-row a { text-decoration: none; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: .72rem; font-weight: 500; padding: 3px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em; flex: 0 0 auto;
}
.chip-pending { background: rgba(183,147,90,0.10); color: #B7935A; }
.chip-processing { background: rgba(183,147,90,0.12); color: #B7935A; }
.chip-done { background: var(--accent-soft); color: var(--accent-dark); }
.chip-failed, .chip-rejected { background: var(--danger-soft); color: var(--danger); }
.manual-entry { margin-top: 12px; }
.manual-entry summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; }

/* timeline */
.timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.timeline-head select { width: auto; min-width: 140px; }
.timeline { margin: 12px 0; }
.tl-group-date {
  font-size: .8rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 6px;
}
.tl-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; margin: 8px 0;
  display: flex; gap: 12px; align-items: flex-start;
}
.tl-icon { font-size: 1.2rem; flex: 0 0 auto; margin-top: 1px; }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-weight: 600; }
.tl-sub { font-size: .88rem; color: var(--muted); }
.tl-sub a { color: var(--muted); }
.tl-edited { font-size: .72rem; color: var(--amber); font-weight: 700; text-transform: uppercase; }
.tl-actions { flex: 0 0 auto; display: flex; gap: 2px; }
.tl-actions button { background: none; border: none; cursor: pointer; font-size: .95rem; padding: 8px; min-width: 36px; min-height: 36px; color: var(--muted); }
.lab-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .88rem; }
.lab-table td, .lab-table th { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); }
.lab-flag-high, .lab-flag-low, .lab-flag-abnormal { color: var(--danger); font-weight: 700; }

/* document page */
.doc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .doc-split { grid-template-columns: 1fr; } }
.doc-viewer iframe { width: 100%; height: 70vh; border: none; border-radius: 8px; }
.doc-viewer img { max-width: 100%; border-radius: 8px; }
.extract-section { margin-bottom: 14px; }
.extract-section h3 { margin: 0 0 4px; font-size: .95rem; }
.extract-kv { font-size: .9rem; margin: 2px 0; }
.extract-kv .k { color: var(--muted); }

/* chat */
.chat-shell { display: flex; flex-direction: column; height: calc(100vh - 160px); min-height: 420px; padding: 0; overflow: hidden; }
.chat-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.chat-head h1 { font-size: 1.15rem; margin: 0; }
.chat-head p { margin: 2px 0 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; }
.msg { max-width: 85%; margin: 8px 0; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: break-word; }
.msg-user { background: var(--accent); color: var(--ink); margin-left: auto; border-bottom-right-radius: 4px; }
.msg-assistant { background: var(--accent-soft); border-bottom-left-radius: 4px; }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.chat-suggestions { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.suggestion {
  text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font: inherit; font-size: .92rem; color: var(--accent-dark);
  cursor: pointer; min-height: 44px;
}
.suggestion:hover { border-color: var(--accent); }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input textarea { flex: 1; margin: 0; max-height: 120px; }
.disclaimer {
  margin: 0; padding: 8px 14px 12px; font-size: .75rem; color: var(--muted); text-align: center;
}
.typing { color: var(--muted); font-style: italic; }

/* emergency management */
.em-link-box {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0;
}
.em-link-box input { flex: 1; min-width: 200px; font-size: .85rem; }

/* emergency public page */
.em-body { background: #fff; }
.em-page { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }
.em-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.em-brand { font-family: 'Hanken Grotesk', sans-serif; font-size: .8rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 0; }
.em-header h1 { font-size: 1.7rem; margin: 2px 0; }
.em-allergy {
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger); border-radius: 10px;
  padding: 12px 14px; font-size: 1.05rem; margin: 14px 0;
}
.em-allergy.none { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }
.em-section { margin: 20px 0; }
.em-section h2 { border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.em-section table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.em-section td, .em-section th { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.em-section tr.flagged td { color: var(--danger); }
.em-section .none { color: var(--muted); }
.em-recent { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.em-recent li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.em-date { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
.em-type { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--accent-dark); margin-right: 6px; }
.em-footer { font-size: .78rem; margin-top: 28px; }

/* landing page */
.landing { background: var(--bg); }
.land-nav {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1020px; margin: 0 auto; padding: 14px 20px;
}
.land-hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center;
  max-width: 1020px; margin: 0 auto; padding: 28px 20px 40px;
}
.land-hero h1 {
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 16px;
}
.land-hero h1 em { color: var(--accent); font-style: normal; }
.land-sub { font-size: 1.08rem; color: var(--muted); max-width: 34rem; }
.land-cta { margin-top: 22px; }
.land-cta.center { text-align: center; margin-top: 28px; }
.btn-big { font-size: 1.08rem; padding: 14px 26px; }
.land-hero-photo img {
  width: 100%; border-radius: 22px; box-shadow: 0 12px 32px rgba(36,49,59,.18);
  transform: rotate(1.5deg);
}
.photo-cap { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 10px; }
.land-story {
  background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.land-story {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 36px; align-items: center;
  padding: 48px 20px;
}
.land-story > div { max-width: 520px; }
.land-story-photo { justify-self: end; }
.land-story-photo img {
  width: 100%; border-radius: 18px; box-shadow: 0 8px 24px rgba(36,49,59,.15);
  transform: rotate(-1.5deg);
}
.land-story-copy h2 { font-size: 1.6rem; margin-bottom: 12px; }
.land-story-copy p { margin: 0 0 14px; font-size: 1.02rem; }
.land-features { max-width: 1020px; margin: 0 auto; padding: 48px 20px 8px; }
.land-features h2, .land-steps h2 { text-align: center; font-size: 1.5rem; margin-bottom: 24px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { margin: 0; }
.feature-icon { font-size: 1.8rem; margin-bottom: 8px; }
.feature h3 { margin: 0 0 8px; font-size: 1.05rem; }
.feature h3 em { color: var(--accent); font-style: normal; }
.feature p { margin: 0; font-size: .95rem; color: var(--muted); }
.land-steps { max-width: 720px; margin: 0 auto; padding: 40px 20px 56px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.step-n {
  flex: 0 0 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.land-footer {
  border-top: 1px solid var(--line); text-align: center;
  padding: 28px 20px 40px; color: var(--muted);
}
@media (max-width: 760px) {
  .land-hero { grid-template-columns: 1fr; padding-top: 12px; }
  .land-hero-photo { order: -1; max-width: 420px; margin: 0 auto; }
  .land-story { grid-template-columns: 1fr; }
  .land-story-photo { justify-self: center; max-width: 420px; }
  .feature-grid { grid-template-columns: 1fr; }
}

@media print {
  .noprint { display: none !important; }
  .em-page { padding: 0; max-width: none; }
  body { font-size: 12px; }
}

.story-allpersons { color: var(--accent-dark); font-weight: 600; }

/* insurance band on landing */
.land-insurance { max-width: 1020px; margin: 0 auto; padding: 8px 20px 8px; }
.ins-band { display: flex; gap: 20px; align-items: flex-start; background: var(--accent-soft); border-color: var(--accent); padding: 24px; }
.ins-band-icon { font-size: 2.2rem; line-height: 1; }
.ins-band h2 { margin: 0 0 8px; font-size: 1.3rem; }
.ins-band p { margin: 0 0 10px; }
@media (max-width: 600px) { .ins-band { flex-direction: column; gap: 8px; } }

/* doctor visit prep */
.vp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.vp-head h2 { margin: 0; }
.vp-content {
  white-space: pre-wrap; font-family: inherit; font-size: .97rem;
  background: var(--accent-soft); border-radius: 10px; padding: 16px; margin-top: 12px;
  overflow-wrap: break-word;
}

/* person greeting card — the person says hi, grounded in the record */
.greeting-card { display: flex; gap: 14px; align-items: flex-start; background: var(--accent-soft); }
.greeting-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 48px;
  background: #fff; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.greeting-avatar img { width: 100%; height: 100%; object-fit: cover; }
.greeting-text { white-space: pre-wrap; font-size: 1.02rem; line-height: 1.6; }

/* care team */
.invite-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.invite-fresh { margin-top: 12px; padding: 12px 14px; background: var(--accent-soft); border-radius: 10px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 44px; flex-wrap: wrap; }
.team-row:first-child { border-top: none; }
.team-who { flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; }

/* join page */
.join-wrap { max-width: 440px; margin: 0 auto; padding: 40px 20px; text-align: center; }
.join-photo {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 18px;
  background: var(--accent-soft); overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 2.6rem;
  box-shadow: 0 10px 28px rgba(19,16,16,.18);
}
.join-photo img { width: 100%; height: 100%; object-fit: cover; }
.join-wrap h1 { font-size: 1.6rem; margin-bottom: 12px; }
.join-card { text-align: left; margin-top: 20px; }
.join-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.join-tab {
  flex: 1; min-height: 44px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted);
}
.join-tab.on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }

/* google sign-in */
.btn-google { background: #fff; border: 1.5px solid var(--line); color: var(--ink); gap: 10px; }
.btn-google:hover { border-color: var(--ink); }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 14px 0;
  color: var(--muted); font-size: .82rem;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* start flow — give your person a voice */
.start-wrap { max-width: 460px; margin: 0 auto; padding: 28px 22px 60px; text-align: center; }
.start-brand { font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; display: inline-block; margin-bottom: 40px; }
.start-step { display: none; animation: stepin .35s ease; }
.start-step.on { display: block; }
@keyframes stepin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.start-kicker { font-family: 'Hanken Grotesk', sans-serif; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-dark); margin-bottom: 14px; }
.start-h { font-size: 1.9rem; line-height: 1.15; margin-bottom: 22px; }
.start-input {
  font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 1.7rem;
  text-align: center; border: none; border-bottom: 3px solid var(--line);
  border-radius: 0; padding: 8px 4px 12px; margin-bottom: 20px; background: transparent;
}
.start-input:focus { outline: none; border-bottom-color: var(--accent); }
.btn-big-start { font-size: 1.08rem; padding: 15px 26px; }
.start-alt { margin-top: 18px; }
.start-back { margin-top: 8px; }
.start-card { text-align: left; }
.start-dots { display: flex; gap: 8px; justify-content: center; margin-top: 34px; }
.start-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.start-dots .dot.on { background: var(--accent); }
.s-name-echo { color: var(--accent-dark); }
.btn .s-name-echo { color: inherit; }
.inline-add { padding: 0 4px; min-height: 0; font-size: .9em; }

/* diet card */
.food-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.food-row:first-child { border-top: none; }
.food-icon { flex: 0 0 auto; font-size: 1.1rem; }
.food-main { flex: 1; min-width: 0; }

/* memories + photo edit */
.memory-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.memory-row:first-child { border-top: none; }
.memory-text { flex: 1; font-size: .95rem; }
.person-photo-editable { cursor: pointer; position: relative; }
.person-photo-editable:hover { outline: 3px solid var(--accent); }
.chip-stored { background: var(--accent-soft); color: var(--accent-dark); }
.tl-time { font-family: 'Hanken Grotesk', sans-serif; font-size: .78rem; color: var(--muted); font-weight: 400; }

/* album */
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.album-grid-full { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.album-item { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--accent-soft); }
.album-item img { width: 100%; height: 100%; object-fit: cover; }
.album-date {
  position: absolute; bottom: 0; left: 0; right: 0;
  font-family: 'Hanken Grotesk', sans-serif; font-size: .62rem; color: #fff;
  background: linear-gradient(transparent, rgba(19,16,16,.65)); padding: 12px 6px 4px; text-align: right;
}

/* records inbox + insurer linking */
.inbox-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.inbox-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inbox-addr { font-family: var(--mono, monospace); font-size: 0.85rem; word-break: break-all; background: var(--cream, rgba(183,147,90,0.07)); color: var(--coal, #1B2029); padding: 6px 10px; border-radius: 8px; }
.btn-small { padding: 6px 14px; min-height: 36px; font-size: 0.85rem; }
.insurer-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.caregiver-head { display: flex; gap: 16px; align-items: center; }
.caregiver-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold, #B7935A); flex-shrink: 0; }
.caregiver-note { background: var(--cream, rgba(183,147,90,0.07)); color: var(--coal, #1B2029); border-radius: 10px; padding: 14px 16px; line-height: 1.55; }
#caregiver-note-form textarea { width: 100%; box-sizing: border-box; margin-bottom: 10px; font: inherit; padding: 10px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.2); }
.quick-add { display: flex; gap: 8px; margin-top: 10px; }
.quick-add input, .quick-add select { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.22); }
.dna-inline { margin-top: 4px; }
.dna-inline .quick-add { flex-wrap: wrap; }
.dna-inline .quick-add label { display: contents; }

/* bigger, always-visible note card */
.note-form textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 12px; border-radius: 10px; border: 1.5px solid rgba(0,0,0,0.25); min-height: 110px; resize: vertical; }
.note-form textarea:focus { outline: 2px solid var(--rust, #B7935A); border-color: transparent; }
.note-form select, .note-form input { font-size: 16px; }

/* hear-the-person speech buttons */
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.msg-speak { display: block; margin-top: 8px; background: none; border: 1px solid rgba(0,0,0,0.18); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 0.95rem; line-height: 1.4; }
.msg-speak:active { transform: scale(0.96); }
.greeting-body .msg-speak { margin-top: 10px; }

/* medication logger */
.med-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,0.07); }
.med-row:last-child { border-bottom: none; }
.med-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.med-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-give { background: var(--cream, rgba(183,147,90,0.07)); color: var(--coal, #1B2029); border: 1.5px solid var(--rust, #B7935A); border-radius: 999px; padding: 10px 16px; min-height: 44px; font-weight: 600; cursor: pointer; }
.btn-give.given { background: var(--rust, #B7935A); color: #fff; border-color: var(--rust, #B7935A); }
.med-stop { font-size: 0.8rem; }

/* person page tabs */
.person-tabs { display: flex; gap: 8px; position: sticky; top: 0; z-index: 20; background: var(--paper, #FFFFFF); padding: 10px 0; margin: 4px 0 12px; border-bottom: 1px solid rgba(0,0,0,0.08); }
.person-tab { flex: 1; min-height: 44px; border: 1.5px solid rgba(0,0,0,0.15); background: transparent; color: var(--coal, #1B2029); border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; padding: 8px 6px; }
.person-tab.on { background: var(--coal, #1B2029); color: #fff; border-color: var(--coal, #1B2029); }
.tab-pane { display: none; }
.tab-pane.on { display: block; }

/* the hidden attribute must always win (generic input rule was overriding it) */
[hidden] { display: none !important; }

/* compact header actions: primary full-width, rest in a 2-col grid */
.person-actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
.person-actions .btn-primary { grid-column: 1 / -1; }
.person-actions .btn { padding: 10px 8px; font-size: 0.92rem; white-space: nowrap; }

/* phone-first chat: fill the screen, bigger bubbles and input */
.chat-messages { font-size: 1rem; line-height: 1.55; }
@media (max-width: 600px) {
  .chat-shell { height: calc(100vh - 132px); height: calc(100dvh - 132px); min-height: 380px; border-radius: 12px; }
  .msg { font-size: 1.06rem; max-width: 92%; padding: 12px 15px; }
  .chat-head { padding: 10px 14px 8px; }
  .chat-head h1 { font-size: 1.35rem; }
  .chat-head .muted.small { font-size: 0.8rem; }
  .chat-input { padding: 10px; }
  .chat-input textarea { font-size: 16px; padding: 12px; border-radius: 12px; }
  .chat-input .btn { min-height: 48px; padding: 12px 20px; font-size: 1rem; }
  .crumbs { margin: 2px 0 6px; }
  .disclaimer { font-size: 0.68rem; padding: 6px 14px 10px; }
}

/* status chips under the greeting */
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 14px; }
.status-chips:empty { display: none; }
.chip-stat { background: var(--cream, rgba(183,147,90,0.07)); color: var(--coal, #1B2029); border-radius: 999px; padding: 7px 13px; font-size: 0.85rem; font-weight: 600; }
.chip-good { background: #e5f0e2; }
.chip-warn { background: rgba(183,147,90,0.12); }
.chip-alert { background: var(--danger-soft, #f7dfdb); color: var(--danger, #B3271B); }

/* mobile-first chat: the conversation IS the screen */
.chat-back { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; font-size: 1.5rem; text-decoration: none; color: inherit; border-radius: 50%; flex-shrink: 0; }
.chat-back:active { background: rgba(0,0,0,0.06); }
.chat-head { align-items: center; flex-wrap: nowrap; gap: 8px; }
.chat-head h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-intro { margin: 4px 4px 14px; line-height: 1.5; }
@media (max-width: 600px) {
  .chat-page .topbar { display: none; }
  .chat-page .page { padding: 6px 8px 0; }
  .chat-shell { height: calc(100vh - 80px); height: calc(100dvh - 80px); }
  .chat-head { padding: 6px 8px; }
  .chat-head h1 { font-size: 1.2rem; }
  .disclaimer { font-size: 0.6rem; line-height: 1.35; padding: 4px 12px 8px; }
}

/* recommendations card */
.recs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.recs-progress { font-size: 0.8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.recs-bar { height: 6px; border-radius: 999px; background: rgba(0,0,0,0.08); margin: 8px 0 12px; overflow: hidden; }
.recs-bar-fill { height: 100%; border-radius: 999px; background: var(--rust, #B7935A); transition: width 0.4s; }
.rec-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; text-decoration: none; color: inherit; border-bottom: 1px solid rgba(0,0,0,0.06); min-height: 44px; }
.rec-row:last-child { border-bottom: none; }
.rec-row:active { background: rgba(0,0,0,0.03); }
.rec-icon { font-size: 1.3rem; flex-shrink: 0; }
.rec-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rec-go { margin-left: auto; color: var(--rust, #B7935A); font-weight: 700; flex-shrink: 0; }

/* high-priority alert banners + refused doses */
.alert-banner { border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; font-weight: 600; font-size: 0.92rem; line-height: 1.45; }
.alert-red { background: var(--danger-soft, #f7dfdb); color: var(--danger, #B3271B); border: 1.5px solid var(--danger, #B3271B); }
.alert-amber { background: rgba(183,147,90,0.12); color: #B7935A; border: 1.5px solid #B7935A; }
.med-refused { color: var(--danger, #B3271B); }
.med-minor { display: flex; gap: 10px; align-items: center; }
.med-actions { flex-direction: column; align-items: flex-end; gap: 6px; }

/* alert polish: resolved pill, clear button, refusal tags, crisis grouping */
.alert-banner { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.alert-ok { background: #e5f0e2; color: #3c5a34; border: 1.5px solid #8fb383; font-weight: 500; }
.alert-clear { background: none; border: none; font-size: 1rem; cursor: pointer; color: inherit; opacity: 0.7; padding: 2px 6px; min-width: 32px; min-height: 32px; flex-shrink: 0; }
.skip-tags { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 0 2px; }
.skip-tag { border: 1px solid rgba(0,0,0,0.2); background: var(--cream, rgba(183,147,90,0.07)); color: var(--coal, #1B2029); border-radius: 999px; padding: 7px 12px; font-size: 0.82rem; cursor: pointer; min-height: 34px; }
.skip-tag:active { background: var(--fawn, rgba(27,32,41,0.14)); }
.med-row { flex-wrap: wrap; }
.btn-crisis { border: 1.5px solid var(--danger, #B3271B) !important; color: var(--danger, #B3271B) !important; background: var(--danger-soft, #f7dfdb) !important; }

/* due-dose highlighting */
.med-row-due { background: rgba(183,147,90,0.08); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.med-due { color: #B7935A; font-weight: 700; }
.btn-give.due { background: var(--rust, #B7935A); color: #fff; animation: due-pulse 1.6s ease-in-out infinite; }
@keyframes due-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(169,114,75,0.45); } 50% { box-shadow: 0 0 0 8px rgba(169,114,75,0); } }
.reminder-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-reminder { border: 1.5px solid var(--rust, #B7935A); font-weight: 600; }
.btn-reminder.on, #push-enable.on { background: var(--rust, #B7935A); color: #fff; }
.med-cg { border: 1px solid rgba(0,0,0,0.2); background: transparent; color: var(--muted, rgba(27,32,41,0.66)); border-radius: 999px; padding: 5px 10px; font-size: 0.75rem; cursor: pointer; min-height: 30px; }
.med-cg.on { background: var(--cream, rgba(183,147,90,0.07)); color: var(--coal, #1B2029); border-color: var(--rust, #B7935A); font-weight: 600; }

/* photo notes — little posts on the timeline */
.tl-photo { display: block; max-width: 240px; max-height: 240px; width: auto; border-radius: 12px; margin: 8px 0 4px; border: 1px solid rgba(0,0,0,0.08); }
.note-photo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#note-photo-btn.on { background: var(--cream, rgba(183,147,90,0.07)); border-color: var(--rust, #B7935A); font-weight: 600; }

/* the person's own reaction to a shared moment */
.tl-reaction { background: var(--cream, rgba(183,147,90,0.07)); border-left: 3px solid var(--rust, #B7935A); border-radius: 0 10px 10px 0; padding: 8px 12px; margin: 6px 0 2px; font-style: italic; line-height: 1.5; }
.rel-chip { font-size: 0.78rem; }
.greeting-photo { display: block; max-width: 180px; max-height: 180px; border-radius: 12px; margin-top: 10px; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
@media (max-width: 400px) { .topnav { gap: 10px; } .topnav a, .topnav button { font-size: 0.9rem; } }
.med-instr { color: #B7935A; background: rgba(183,147,90,0.08); border-radius: 6px; padding: 2px 8px; display: inline-block; margin-top: 2px; }
.inbox-review { background: rgba(183,147,90,0.08); border: 1.5px solid #B7935A; border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.chip-inbox { background: rgba(183,147,90,0.12); color: #B7935A; }
.email-card { border: 1.5px solid var(--rust, #B7935A); background: #FFFFFF; }

/* help center */
.help-ask-card { border: 1.5px solid var(--rust, #B7935A); }
.help-messages { max-height: 320px; overflow-y: auto; margin: 8px 0; }
.help-messages:empty { display: none; }
.help-section summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.help-icon { font-size: 1.3rem; }
.help-body { line-height: 1.65; margin-top: 10px; white-space: pre-wrap; }
.chat-cam { padding: 10px 12px; min-height: 44px; flex-shrink: 0; }
.mail-item { padding: 12px 0; border-bottom: 1px solid rgba(0,0,0,0.07); }
.mail-item:last-child { border-bottom: none; }
.mail-quote { margin: 8px 0; padding: 8px 12px; background: var(--cream, rgba(183,147,90,0.07)); border-left: 3px solid #B7935A; border-radius: 0 8px 8px 0; font-style: italic; font-size: 0.92rem; line-height: 1.5; }
.mail-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.share-card { border: 1.5px dashed #B7935A; background: #FFFFFF; }
.tl-pills { display: flex; gap: 8px; margin: 6px 0; }
.tl-pill { border: 1.5px solid rgba(0,0,0,0.15); background: transparent; border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.tl-pill.on { background: var(--coal, #1B2029); color: #fff; border-color: var(--coal, #1B2029); }
.timeline-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.chip-inbox { background: rgba(183,147,90,0.12); color: #B7935A; font-weight: 700; }
.chip-processing { background: rgba(27,32,41,0.08); color: rgba(27,32,41,0.7); }
.med-edit-form { width: 100%; display: grid; gap: 8px; padding: 10px 0 4px; }
.med-edit-form label { display: block; font-size: 0.85rem; color: var(--muted, rgba(27,32,41,0.66)); }
.med-edit-form input { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 10px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.22); margin-top: 3px; }
.skip-tag.on { background: var(--coal, #1B2029); color: #fff; border-color: var(--coal, #1B2029); }
.rel-name { font: inherit; font-size: 16px; padding: 7px 10px; border-radius: 999px; border: 1px solid rgba(0,0,0,0.22); min-width: 150px; }
.doc-type { background: var(--fawn, rgba(27,32,41,0.14)); color: var(--coal, #1B2029); border-radius: 999px; padding: 3px 10px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.compose-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.compose-chip { border: 1.5px solid rgba(0,0,0,0.15); background: transparent; border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.compose-chip.on { background: var(--cream, rgba(183,147,90,0.07)); border-color: var(--accent, #B7935A); }
.tl-media { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.tl-media .tl-photo { margin: 0; max-width: 180px; max-height: 180px; }
video.tl-photo { background: #000; }
.lib-group { margin-bottom: 16px; }
.lib-who { font-weight: 700; margin-bottom: 4px; border-bottom: 1.5px solid var(--line, rgba(27,32,41,0.14)); padding-bottom: 6px; }
@media (max-width: 480px) { .person-tab { padding: 8px 8px; font-size: 0.9rem; } }
.intake-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.intake-sum { font-weight: 700; margin-bottom: 8px; font-size: 1.05rem; }

/* public moments feed: real social-feed sizing */
.pubfeed .tl-media { display: block; }
.pubfeed .tl-media .tl-photo { width: 100%; max-width: 100%; height: auto; max-height: none; border-radius: 14px; margin: 0 0 8px; display: block; }
.pubfeed video.tl-photo { max-height: 70vh; width: 100%; }
.pub-check { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.pub-check input { width: 20px; height: 20px; accent-color: #B7935A; }
.intake-target { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line, rgba(27,32,41,0.14)); }

/* chat composer: big box, Ask button underneath */
.chat-input { flex-direction: column; align-items: stretch; gap: 8px; }
.chat-input textarea { width: 100%; box-sizing: border-box; min-height: 68px; max-height: 160px; font-size: 16px; padding: 12px; border-radius: 12px; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row .chat-cam { flex-shrink: 0; min-width: 54px; }
.chat-input-row #chat-send { flex: 1; min-height: 50px; font-size: 1.05rem; font-weight: 700; }

/* preventive-care card */
.well-sec { margin: 12px 0 4px; color: var(--ink, #1B2029); }
.well-sec > strong { display: block; margin-bottom: 6px; }
.well-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 0.92rem; line-height: 1.45; }
.well-item.well-attn { background: rgba(183,147,90,0.08); border-radius: 10px; padding: 8px 10px; }
.well-dot { flex-shrink: 0; }
.well-foot { margin-top: 10px; }
.unexp-box { border: 1.5px solid #B7935A; border-radius: 12px; padding: 12px; margin: 10px 0; background: rgba(183,147,90,0.05); }
.unexp-head { font-weight: 700; margin-bottom: 6px; }
.unexp-list { margin: 8px 0; font-size: 0.9rem; line-height: 1.6; }
.unexp-open { color: #B3271B; font-weight: 600; }
.unexp-q { font-size: 0.9rem; line-height: 1.55; margin-top: 8px; }

.memorial-band { background: #1B2029; color: #D2B183; border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-family: 'Cormorant Garamond', serif; font-size: 1.08rem; text-align: center; }

/* the whole-story keepsake page */
.story-content { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.13rem; line-height: 1.75; white-space: pre-wrap; }
@media print {
  header, .crumbs, .vp-head div, #story-meta, footer, .nav { display: none !important; }
  .card { border: none; box-shadow: none; padding: 0; }
  .story-content { font-size: 12.5pt; }
}

/* stork logo mark (EKG-to-stork) */
.logo-mark { height: 30px; width: auto; vertical-align: -9px; }
.logo-mark-big { display: block; height: 54px; margin: 0 auto 6px; }

/* topbar lockup: logo + name inline, never wrapping */
.brand { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

/* start flow: who-is-this-for chooser */
.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.who-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 10px; font: inherit; font-weight: 600; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-radius: 16px; color: var(--ink);
}
.who-btn span { font-size: 2rem; }
.who-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.who-btn:last-child { grid-column: 1 / -1; }

/* password show/hide */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.05rem;
  min-height: 36px; min-width: 40px; padding: 0; color: var(--muted);
}

/* daily quick log */
.quicklog-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.quicklog-row input { flex: 1; margin-top: 0; }
.quicklog-row .btn { flex: 0 0 auto; }
#quicklog-status { min-height: 1.2em; margin: 4px 0 8px; }
