/* Doc Jen App members' website. Colours match the Android app (ui/Ui.java). */
:root {
  --teal: #0B7A8C;
  --teal-dark: #075E6C;
  --teal-soft: #E3F2F3;
  --navy: #12344A;
  --gold: #FFD27A;
  --pink: #E07A93;
  --bg: #F3F7F8;
  --card: #FFFFFF;
  --text: #12344A;
  --muted: #5B7080;
  --line: #D6E2E6;
  --ai-bg: #FDF3DC;
  --ai-text: #854F0B;
  --ok-bg: #E4F4EA;
  --ok: #2E8B57;
  --warn: #B54A35;
  --red: #A32D2D;
  --red-soft: #FCEBEB;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
[hidden] { display: none !important; }
a { color: var(--teal-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.brand span { color: #7FD3DF; font-weight: 600; margin-left: 2px; }
.who { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.who-email { color: #CDEBEE; overflow-wrap: anywhere; }
.toplink { color: #BFE9EF; font: inherit; font-weight: 600; }
/* Comfortable taps on phones (QA run 001, DEF-007): the bar's links are 44px tall; the bar keeps its height. */
.topbar { padding-block: 2px; }
.brand, .toplink { display: inline-flex; align-items: center; min-height: 44px; }
.as-link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

main { max-width: 760px; margin: 0 auto; padding: 16px; }

/* ---------------------------------------------------------------- hero (landing header) */
.hero {
  background: linear-gradient(135deg, var(--teal), var(--navy));
  color: #fff; border-radius: 20px; padding: 20px;
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.hero .tagline { font-size: 26px; font-weight: 800; margin: 0 0 6px; line-height: 1.5; }
.hero .tagline b { color: var(--gold); }
.hero .rule { width: 56px; height: 4px; border-radius: 2px; background: var(--gold); margin: 6px 0 12px; }
.hero .greeting { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.hero .sub { color: #CDEBEE; font-size: 14px; margin: 0; }
/* The featured professional (owner, 2026-11-02): photo beside the name, role and place. */
.featured {
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto; max-width: 340px; min-width: 0;
  background: rgba(255, 255, 255, .12); border-radius: 16px; padding: 10px 14px 10px 10px;
  color: #fff; text-decoration: none; transition: opacity .3s;
}
.featured:hover { background: rgba(255, 255, 255, .2); }
.featured.fade { opacity: 0; }
.featured img {
  width: 68px; height: 68px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  border: 3px solid var(--gold); background: #fff;
}
.featured .words { display: flex; flex-direction: column; min-width: 0; }
.featured .name { font-size: 15px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.featured .role { font-size: 13px; color: #CDEBEE; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.featured .where { font-size: 13px; font-weight: 700; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .hero { padding: 16px; flex-direction: column; align-items: stretch; }
  .hero .tagline { font-size: 22px; }
  .featured { max-width: none; }
}

/* ---------------------------------------------------------------- cards and buttons */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-bottom: 12px;
}
.card.soft { background: var(--teal-soft); border-color: #C5E3E6; }
.card.danger { background: var(--red-soft); border-color: #F1C9C9; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 2px solid var(--teal);
  background: var(--teal); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.secondary { background: #fff; color: var(--teal-dark); }
.btn.secondary:hover { background: var(--teal-soft); }
.btn.red { background: var(--red); border-color: var(--red); }
.btn.redcross { background: #C8102E; border-color: #C8102E; }  /* Philippine Red Cross, as in the app */
.btn.block { width: 100%; }
/* Long labels (often English / Filipino) wrap into even lines instead of leaving one word alone (debugging list item 1, issue #216). */
.btn { text-align: center; line-height: 1.25; text-wrap: balance; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
/* Side by side only when each button has room for its words (about 220 px); on phones they stack, full width. A plain
   link beside a button (Stop, Itigil) keeps its own height instead of being stretched. */
.btn-row .btn { flex: 1 1 220px; align-self: stretch; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--teal-dark); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-align: left; }
.link-btn.danger { color: var(--warn); }
.back { display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 4px; font-weight: 600; }
/* Sign-in page links (Forgot password?, Create an account…): 44px tall to tap (DEF-007). */
.tap-link { display: inline-flex; align-items: center; min-height: 44px; }

/* Big menu rows (Find a doctor / pharmacy / emergency, family members) */
.menu { display: grid; gap: 10px; }
.menu-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  color: var(--text); text-decoration: none; cursor: pointer; text-align: left; font: inherit; width: 100%;
}
.menu-row:hover { border-color: var(--teal); }
.menu-row .ic { flex: 0 0 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--teal-soft); }
.menu-row .ic.red { background: var(--red-soft); }
.menu-row .words { flex: 1; min-width: 0; }
.menu-row .title { font-weight: 700; font-size: 17px; display: block; }
.menu-row .desc { color: var(--muted); font-size: 13px; display: block; }
.menu-row .chev { color: var(--teal); font-size: 26px; font-weight: 700; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
input[type=text], input[type=number], input[type=time], input[type=month], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 12px; border-radius: 12px; border: 1px solid #B9CCD2; background: #fff; color: var(--text);
}
textarea { min-height: 140px; resize: vertical; }
/* Every one-line box is the same height, so a date box, a list and a text box side by side line up (issue #216). */
input[type=text], input[type=number], input[type=time], input[type=month], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=search], select {
  height: 50px; line-height: 1.5;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, .menu-row:focus-visible { outline: 3px solid #7FD3DF; outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
/* A field in a two-column row: label above its box, and the boxes in a row line up even when one label takes two lines
   (debugging list item 1, issue #216). */
.grid2 > .field { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.form-error { color: var(--warn); font-weight: 600; margin-top: 10px; }
.filter { display: flex; gap: 10px; flex-wrap: wrap; }
.filter > * { flex: 1 1 200px; }

/* ---------------------------------------------------------------- directory entries */
.entry h3 { margin-bottom: 2px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); margin-right: 6px; }
.badge.gray { background: #EEF2F4; color: var(--muted); }
.badge.warn { background: #FDECEA; color: var(--red); }
/* 📅 Today: the buttons of one item stay together, and wrap under it on a phone. */
.today-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.today-actions select { width: auto; }
@media (max-width: 600px) { .rec:has(.today-actions) { flex-direction: column; } .today-actions { justify-content: flex-start; } }
.badge.red { background: var(--red-soft); color: var(--red); }
.place { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; }
.tel { font-weight: 700; white-space: nowrap; }

/* ---------------------------------------------------------------- answers */
.answer { border-radius: 12px; padding: 12px; margin-top: 10px; white-space: pre-wrap; }
.answer .label { font-weight: 700; font-size: 13px; display: block; margin-bottom: 4px; white-space: normal; }
.answer.verified { background: var(--ok-bg); }
.answer.verified .label { color: var(--ok); }
.answer.ai { background: var(--ai-bg); }
.answer.ai .label { color: var(--ai-text); }
.answer.waiting { background: var(--teal-soft); color: var(--muted); white-space: normal; }
.answer .note { display: block; font-size: 12px; color: var(--muted); margin-top: 8px; white-space: normal; }
.ready { background: var(--ok-bg); border-radius: 12px; padding: 12px; margin-top: 10px; }
.ready h4 { margin: 0; color: var(--ok); font-size: 14px; }
.ready details { border-top: 1px solid #CBE6D4; padding: 8px 0 2px; margin-top: 8px; }
.ready summary { cursor: pointer; font-weight: 700; }
.ready .body { white-space: pre-wrap; margin: 6px 0; font-size: 14px; }
.qtext { white-space: pre-wrap; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- records */
.rec { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.rec:first-of-type { border-top: 0; }
.rec .what { font-weight: 700; }
.rec .meta { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.tabs button { flex: 1 1 auto; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------------------------------------------------------------- family tree */
.tree { text-align: center; }
.band-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.band { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; padding-top: 6px; }
.unit { display: flex; align-items: flex-start; }
.vline { width: 2px; height: 18px; background: #9BB7C0; margin: 6px auto; }
.node { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 4px; width: 72px; display: flex; flex-direction: column; align-items: center; }
.node.big { width: 92px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.node.big .avatar { width: 52px; height: 52px; font-size: 17px; }
.node.me .avatar { width: 60px; height: 60px; background: var(--teal) !important; color: #fff !important; box-shadow: 0 0 0 3px var(--gold); }
.node .nm { font-weight: 700; font-size: 12px; margin-top: 4px; line-height: 1.2; overflow-wrap: anywhere; }
.node.big .nm { font-size: 13px; }
.node .sb { font-size: 11px; color: var(--muted); line-height: 1.2; }
.heart { color: var(--pink); font-weight: 700; padding-top: 14px; }
.b0 .avatar { background: #FAEEDA; color: #854F0B; }
.b1 .avatar { background: #FAECE7; color: #993C1D; }
.b2 .avatar { background: #E3F2F3; color: #075E6C; }
.b3 .avatar { background: #EEEDFE; color: #3C3489; }
.b4 .avatar { background: #EAF3DE; color: #27500A; }

/* ---------------------------------------------------------------- misc */
.loading { color: var(--muted); padding: 24px 0; text-align: center; }
.footer { max-width: 760px; margin: 8px auto 32px; padding: 0 16px; font-size: 14px; color: var(--muted); text-align: center; }
/* Footer links 44×44px to tap, never overlapping (DEF-007); tighter paragraph spacing keeps the footer about the same
   height. The "911" inside the sentence keeps its own width (a link in a sentence), still 44px tall. */
.footer p { margin: 2px 0; }
.footer a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 4px; vertical-align: middle; }
.footer p:first-child a { min-width: 0; padding: 0 2px; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 10;
}
dialog { border: 0; border-radius: 16px; padding: 20px; max-width: min(440px, calc(100% - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(18, 52, 74, .45); }
dialog .btn-row { justify-content: flex-end; }

/* Instant answers chat (same look as the app's ChatScreens) */
.chat { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.bubble { border-radius: 16px; padding: 10px 12px; max-width: 100%; }
.bubble p { margin: 4px 0; }
.bubble.me { align-self: flex-end; max-width: 85%; background: var(--teal); color: #fff; white-space: pre-wrap; }
.bubble.bot { align-self: stretch; margin-right: 24px; background: #fff; border: 1px solid var(--line, #DDE6EA); }
.bubble.bot .btn { margin-top: 8px; }

/* Family tree (PDF): the illustrated A4 tree, its zoom view, and printing only the tree */
.tree-preview { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.tree-preview svg, #treePrint svg { display: block; width: 100%; height: auto; }
dialog.tree-zoom { max-width: none; width: calc(100vw - 16px); height: calc(100vh - 16px); padding: 8px; background: #FBF6EC; }
.tree-zoom-page { overflow: auto; height: calc(100% - 60px); }
.tree-zoom-page svg { display: block; width: 200%; max-width: 1600px; height: auto; margin: 0 auto; }
#treePrint { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  body.print-tree > *:not(#treePrint) { display: none !important; }
  body.print-tree #treePrint { display: block; }
  body.print-tree #treePrint svg { width: 210mm; height: 297mm; }
}

/* Scan a prescription */
.scan-photo { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 12px; background: #F3F7F8; margin: 8px 0; }
label.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin-top: 10px; }
label.choice input { width: auto; margin-top: 4px; }

/* Family tree: dashed "+" places where a relative can be added */
.node.add { text-decoration: none; color: var(--muted); }
/* 🐾 Pet family tree: each pet is a link to its own tree. */
a.node { text-decoration: none; color: inherit; }
/* Adding a pet: 🐶 Dog / 🐱 Cat / 🐾 Other animal first, as big buttons. */
.pet-kind .btn { flex: 1; font-size: 17px; padding: 14px 12px; }
.node.add .avatar { background: #fff; border: 2px dashed #9BB7C0; color: #6F8C96; font-size: 22px; font-weight: 400; }
.node.add .sb { font-size: 11px; text-align: center; }
.node { -webkit-touch-callout: none; user-select: none; }

/* Full concern list (Magtanong) */
dialog.concern-list { max-width: min(520px, calc(100% - 32px)); }
.concern-items { display: grid; gap: 2px; max-height: 60vh; overflow: auto; margin: 8px 0; }
.concern-items .link-btn { text-decoration: none; padding: 8px 4px; border-bottom: 1px solid var(--line); }

/* Professional photos and rows (professional and health organization pages) */
.pro-photo { border-radius: 50%; object-fit: cover; flex: none; background: #E3F2F3; color: var(--teal-dark); display: inline-grid; place-items: center; font-weight: 700; }
.pro-head { display: flex; gap: 12px; align-items: center; }
a.card.pro-row { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }

/* Printable QR codes of a page and its locations (one per A4 page) */
#qrPrint { display: none; }
.qr-sheet { text-align: center; padding: 18mm 12mm; font-family: inherit; color: #12344A; }
.qr-sheet img { width: 120mm; height: 120mm; image-rendering: pixelated; }
.qr-sheet h1 { font-size: 26pt; margin: 0 0 4mm; } .qr-sheet .where { font-size: 13pt; margin: 0 0 8mm; color: #5B7080; }
.qr-sheet .ask { font-size: 15pt; font-weight: 700; margin: 8mm 0 2mm; } .qr-sheet .small { font-size: 11pt; color: #5B7080; }
@media print {
  body.print-qr > *:not(#qrPrint) { display: none !important; }
  body.print-qr #qrPrint { display: block; }
  body.print-qr .qr-sheet { page-break-after: always; break-after: page; }
}

/* 🆔 Medical ID wallet card and 🏷 pet tag (printed with the page QR codes' print mechanism) */
.wallet-card { width: 85.6mm; height: 54mm; box-sizing: border-box; border: 1px solid #12344A; border-radius: 3mm; padding: 3mm 4mm;
  display: flex; gap: 3mm; align-items: center; justify-content: space-between; font-size: 8pt; color: #12344A; margin: 10mm; }
.wallet-card .who { font-size: 11pt; font-weight: 700; margin: 1.5mm 0; }
.wallet-card .line { font-size: 7.5pt; line-height: 1.25; }
.wallet-card img { width: 30mm; height: 30mm; image-rendering: pixelated; }
.pet-tag { width: 40mm; text-align: center; border: 1px solid #12344A; border-radius: 50%; padding: 6mm 4mm; margin: 10mm; font-size: 8pt; color: #12344A; }
.pet-tag img { width: 26mm; height: 26mm; image-rendering: pixelated; display: block; margin: 0 auto 1mm; }
.big-text { font-size: 1.1rem; } .big-text li { margin: 4px 0; }

/* ⭐ Stars and 📊 dashboard tiles */
.stars .star { background: none; border: none; font-size: 1.8rem; line-height: 1; color: #C9A227; cursor: pointer; padding: 0 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tiles .tile { margin: 0; text-align: center; } .tiles .tile .big { font-size: 1.6rem; font-weight: 800; color: var(--teal-dark); }

/* ⏰ One-tap reminder page (large text) */
.big-take { text-align: center; font-size: 1.15rem; } .big-take .big { font-size: 3rem; margin: 0; } .big-take .when { color: var(--muted); }
.btn.huge { font-size: 1.3rem; padding: 18px 22px; margin: 8px 0; } .huge-link { font-size: 1.1rem; margin-top: 10px; }
/* 📈 Health log chart (colors checked for color blindness: series 1 #0E8BA0, series 2 #C2410C) */
.chart-box { --series-1: #0E8BA0; --series-2: #C2410C; margin: 10px 0; }
.log-chart { width: 100%; height: auto; display: block; }
.log-chart .grid { stroke: var(--line); stroke-width: 1; } .log-chart .axis { fill: var(--muted); font-size: 9px; }
.log-chart .direct { fill: var(--text); font-size: 10px; font-weight: 700; }
.legend .key { display: inline-block; width: 14px; height: 3px; vertical-align: middle; border-radius: 2px; }
.legend .k1 { background: var(--series-1); } .legend .k2 { background: var(--series-2); }
.log-input { max-width: 170px; }

/* 🐶🐱 Pet pictures: the pet's photo or drawing in a circle, and the page of drawings to choose from. */
.pet-face { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--teal-soft); line-height: 1; }
.pet-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-row .ic.pet-ic { background: none; border-radius: 50%; }
.pet-pic-head { display: flex; gap: 14px; align-items: center; }
.pet-pic-head h2 { margin: 0 0 4px; }
.pet-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 10px; }
.pet-pic { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 2px solid var(--line, #DDE6E8); border-radius: 16px; background: var(--card, #fff); color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
.pet-pic img { width: 72px; height: 72px; border-radius: 50%; }
.pet-pic:hover { border-color: var(--teal); }
.pet-pic[aria-pressed="true"] { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal) inset; }
.pet-pic .badge { font-size: 11px; }

/* Care identity comes from the backend's distinct named colors (084). */
body[data-care] { --teal: var(--care-color); --teal-dark: var(--care-color); --teal-soft: var(--care-soft); }
.care-panel { --teal: var(--care-color); --teal-dark: var(--care-color); --teal-soft: var(--care-soft); }
.care-patient { background: var(--care-soft); border-left: 5px solid var(--care-color); padding: 12px; font-weight: 700; border-radius: 8px; }
.care-panel textarea { min-height: 120px; }
.care-panel .answer { background: var(--care-soft); border-left: 4px solid var(--care-color); white-space: pre-wrap; }
.care-panel .answer-source { margin: 8px 0; }
.care-panel .question-turn { margin: 16px 0; }
.care-panel .answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.care-panel .answer-actions .btn { flex: 1 1 100%; }
.care-panel .topic-actions { margin: 14px 0; }
.care-panel .saved-topic summary { color: var(--care-color); font-weight: 700; cursor: pointer; }

/* Home page: quick tiles, "What do you need?" and the folded partners' links (debugging list items 5 and 9, issue #228). */
.quick-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.quick-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; padding: 10px 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--text); text-align: center; }
.quick-tile:hover, .quick-tile:focus-visible { border-color: var(--teal); background: var(--teal-soft); }
.quick-tile .qt-ic { font-size: 26px; line-height: 1; }
.quick-tile .qt-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.quick-tile.red { border-color: var(--red); background: var(--red-soft); color: var(--red); }
@media (max-width: 340px) { .quick-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.feature-finder { margin: 4px 0 12px; }
.feature-finder label { margin-top: 0; }
.find-results:empty { display: none; }
.find-results { margin-top: 8px; }
details.fold > summary { cursor: pointer; list-style: revert; }
details.fold[open] > summary { margin-bottom: 8px; }
/* 🏠 Home location: address search and map pin (debugging list item 3, issue #227). */
.home-search { margin-top: 6px; }
.addr-suggestions { display: grid; gap: 6px; margin-top: 6px; }
.addr-option { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; color: var(--text); cursor: pointer; }
.addr-option:hover, .addr-option:focus-visible { border-color: var(--teal); background: var(--teal-soft); }
.home-map { height: 260px; border-radius: 12px; overflow: hidden; margin-top: 10px; border: 1px solid var(--line); }
/* Emergency contacts on the Medical ID: one block per contact (debugging list item 4, issue #226). */
.contact-row { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 2px; margin-top: 10px; background: #FBFDFD; }
.contact-row.raw { padding: 8px 12px; }
.contact-title { margin: 16px 0 2px; }
/* Moving between days: ‹ [📅 date] › and Today (debugging list item 8, issue #224). */
.day-nav { display: flex; align-items: stretch; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.day-nav .day-step { flex: none; width: 52px; padding: 0; font-size: 26px; line-height: 1; }
.day-pick-wrap { flex: 1 1 160px; margin: 0; position: relative; display: flex; align-items: center; }
.day-pick-icon { position: absolute; left: 12px; pointer-events: none; }
.day-nav input.day-pick { height: 48px; padding-left: 40px; font-weight: 600; cursor: pointer; }
.day-nav .day-today { flex: 1 1 100%; }
@media (min-width: 521px) { .day-nav .day-today { flex: none; } }
/* The whole date box opens the calendar (the browser's own small icon is hidden behind it). */
.day-nav input.day-pick::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; opacity: 0; cursor: pointer; }
/* Directory search: the box and its 🔍 Search button on one line; the result count under it (issue #221). */
.search-row { display: flex; gap: 8px; margin-top: 10px; }
.search-row input { flex: 1; min-width: 0; }
.search-row .btn { flex: none; min-height: 50px; padding: 10px 16px; }
.result-summary { font-weight: 600; margin: 12px 4px 0; }
.result-summary .link-btn { padding: 0; }
/* The error under the field it is about (issue #220). */
.field-error { color: var(--warn); font-weight: 600; font-size: 14px; margin: 4px 0 0; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
/* Birthday as Month / Day / Year lists (debugging list item 2, issue #218). */
.birthday-lists { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; }
.birthday-age { margin: 4px 0 0; min-height: 1.2em; }
/* New-account password checklist and strength meter (debugging list item 11, issue #212). */
.pw-help { margin: 6px 0 4px; }
.pw-help-title { margin: 6px 0 2px; font-weight: 600; }
.pw-rules { list-style: none; margin: 0; padding: 0; color: var(--muted); }
.pw-rules li::before { content: "○"; display: inline-block; width: 1.4em; color: var(--muted); }
.pw-rules li.met { color: var(--ok); }
.pw-rules li.met::before { content: "✓"; color: var(--ok); font-weight: 700; }
.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.pw-meter-track { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pw-meter-bar { display: block; height: 100%; width: 0; transition: width .2s, background-color .2s; }
.pw-meter-bar.level1 { width: 33%; background: var(--warn); }
.pw-meter-bar.level2 { width: 66%; background: #C98A1B; }
.pw-meter-bar.level3 { width: 100%; background: var(--ok); }
.pw-meter-word { min-width: 52px; font-size: 13px; font-weight: 600; color: var(--muted); }
/* Small phones (debugging list item 1, issue #216): a little less padding and type, so long button labels fit on fewer lines. */
@media (max-width: 400px) {
  .btn { padding: 10px 14px; font-size: 15px; }
}

/* ---------------------------------------------------------------- spacing between blocks (UI audit, issue #234) */
/* Cards had space only below them and button rows only above them, so a button row followed by a card touched it
   (📅 Today: Day before / Next day on the To do card). Every block now keeps a gap from the one before it. */
.btn-row + :is(.card, section, details, form, .menu, .list, .grid2, h3, h4) { margin-top: 12px; }
:is(#view, form, section, .card) > :is(p, div, input, select, textarea, label, .btn) + .card { margin-top: 12px; }
:is(#view, form, .card) > :is(h2, h3, p, .muted, .back) + .btn-row { margin-top: 12px; }
.card > .btn-row:last-child { margin-bottom: 0; }
/* A button right after a box (Save this link under the pasted link) gets air above it. */
:is(input, select, textarea) + :is(.btn, button.btn) { margin-top: 10px; }
/* Buttons placed in a sentence (a person's page, e-prescriptions, a pet's page) used to wrap onto new lines with no
   gap between them; such a group now lays out like a button row. */
p:has(> .btn ~ .btn), div:not(.btn-row):not(.day-nav):not(.search-row):not(.quick-tiles):has(> a.btn ~ a.btn) {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch;
}
p:has(> .btn ~ .btn) > .btn, div:not(.btn-row):not(.day-nav):not(.search-row):not(.quick-tiles):has(> a.btn ~ a.btn) > a.btn { flex: 1 1 220px; }
/* On phones a two-column row becomes one column: keep a gap between the boxes (pet month and year, age). */
.grid2 { row-gap: 8px; }
.grid2 > .field label, .grid2 > div > label:first-child { margin-top: 12px; }

/* Fold-open headings (Medical ID, Health logs, Results, question topics): big enough for a finger (44 px). */
details > summary { min-height: 44px; padding: 10px 0; box-sizing: border-box; cursor: pointer; }
details.card > summary { margin: -6px 0; }
details[open] > summary { margin-bottom: 6px; }
/* Buttons placed straight on a page or card (E-prescriptions, a pet's page): when they wrap onto new lines they keep
   a gap instead of touching. */
:is(#view, .card, section, form) > .btn:not(.block) { margin: 10px 8px 0 0; }
:is(#view, .card, section, form) > .btn:not(.block):last-of-type { margin-right: 0; }
/* A box under another box in the same place (a list, then "type it" under it): a small gap. Pairs side by side
   (country code and number, Month / Day / Year) are left as they are. */
:is(div, label, form, section, .card):not(.grid2):not(.search-row):not(.birthday-lists):not(.day-pick-wrap) > :is(select, input, textarea) + :is(select, input, textarea) { margin-top: 8px; }
