/* ── Health record ───────────────────────────────────────────
   Section-specific rules; everything else comes from app.css. */

/* The tab strip under the page header (the section has one nav item, so no secbar). */
.htabs{display:flex;gap:4px;margin-bottom:16px;border-bottom:1px solid var(--rule);flex-wrap:wrap}
.htabs a{display:inline-flex;align-items:center;height:36px;padding:0 14px;border-radius:8px 8px 0 0;color:var(--ink-2);font-weight:600;font-size:14px}
.htabs a:hover{background:var(--surface-2)}
.htabs a.on{color:var(--accent);box-shadow:inset 0 -2px 0 var(--accent)}

/* Stat tiles inside a drawer or card. */
.hstats{gap:10px}
.hstats>div{padding:10px 12px;border:1px solid var(--rule);border-radius:var(--r-sm);background:var(--surface);text-align:center}
.hstats .v{font-size:18px;line-height:1.2}
.hstats .v small{font-size:11px;color:var(--muted)}
.hstats .l{font-size:11px;color:var(--muted);margin-top:2px}

/* Live ER visit / stay banner in the drawer. */
.hlive{background:var(--crit);color:#fff;border-radius:var(--r);padding:14px 16px;margin-bottom:14px}
.hlive.stay{background:var(--accent)}
.hlive .big{font-size:30px;line-height:1.1;margin:6px 0 2px}

/* Inline panel inside a drawer (add update, edit, discharge…). */
.hpanel{margin-top:14px;padding:12px 14px;border:1px solid var(--accent);border-radius:var(--r);background:var(--surface-2)}
.hrow{display:flex;align-items:center;gap:10px;padding:9px 4px;border-top:1px solid var(--rule-2);cursor:pointer}
.hrow:hover{background:var(--surface-2)}
.hrow b{font-weight:600}

/* Daily bars for the vitals chart. */
.hbars{display:flex;align-items:flex-end;gap:2px}
.hbars i{flex:1;min-width:3px;background:var(--accent-soft);border-radius:2px 2px 0 0}
.hbars i.on{background:var(--accent)} .hbars i.hi{background:var(--warn)} .hbars i.none{background:var(--rule-2)}
.hhi{color:var(--warn);font-weight:600}

/* Sleep stages bar. */
.hstages{display:flex;height:12px;border-radius:6px;overflow:hidden;background:var(--rule-2)}
.hstages .deep{background:#3B4B9E} .hstages .rem{background:#6E7FD8} .hstages .core{background:#A8B4EE} .hstages .awake{background:var(--rule)}

/* Card images and photo thumbnails. */
.hcard{position:relative;display:grid;place-items:center;aspect-ratio:1.6;border-radius:10px;border:1px solid var(--rule);background:var(--surface-2);color:var(--muted);font-size:13px;overflow:hidden;cursor:pointer}
.hcard.empty{border-style:dashed}
.hcard img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.hcard span{position:absolute;left:8px;bottom:6px;padding:1px 7px;border-radius:6px;background:rgba(0,0,0,.55);color:#fff;font-size:11.5px}
.hphoto{width:100%;border-radius:8px;border:1px solid var(--rule)}
.hthumb{width:56px;height:56px;border-radius:8px;object-fit:cover;border:1px solid var(--rule)}

/* The printable emergency summary. */
.print-page{max-width:800px;margin:0 auto;padding:24px 20px 48px;background:var(--surface);color:var(--ink);min-height:100vh;font-size:14px}
.print-actions{display:flex;justify-content:space-between;gap:8px;margin-bottom:18px}
.print-h{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding-bottom:12px;border-bottom:2px solid var(--ink);margin-bottom:14px}
.print-h h1{font-size:24px}
.print-meta{text-align:right;font-size:12px;color:var(--muted)}
.print-alert{padding:10px 14px;border:2px solid var(--crit);border-radius:8px;color:var(--crit);margin-bottom:14px}
.print-page section{margin-bottom:16px}
.print-page h2{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
.print-page p{margin:0}
.print-cols{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.ptbl{width:100%;border-collapse:collapse}
.ptbl th{text-align:left;font-size:11px;color:var(--muted);padding:4px 6px;border-bottom:1px solid var(--rule)}
.ptbl td{padding:5px 6px;border-bottom:1px solid var(--rule-2);vertical-align:top}
.print-page footer{margin-top:24px;padding-top:8px;border-top:1px solid var(--rule)}
@media (max-width:640px){.print-cols{grid-template-columns:1fr}}
@media print{
  .no-print{display:none!important}
  .print-page{max-width:none;padding:0;color:#000;background:#fff}
  .print-alert{color:#000}
}

/* Type-ahead suggestions under the allergy cause (Health Canada's drug database). */
.hsug{margin-top:6px;border:1px solid var(--rule);border-radius:var(--r-sm);background:var(--surface);overflow:hidden}
.hsug-i{display:flex;flex-direction:column;gap:1px;padding:8px 10px;cursor:pointer;border-top:1px solid var(--rule-2)}
.hsug-i:first-child{border-top:0}
.hsug-i:hover{background:var(--surface-2)}
.hsug-i b{font-weight:600;font-size:14px}

/* Deductible used against the total: neutral, because spending it is neither
   good nor bad — it is just how far along the year is. */
.hded .bar i{background:var(--accent)}

/* The wallet card: two credit-card-size sides, front and back. */
.wallet-sheet{display:flex;flex-wrap:wrap;gap:10mm;max-width:800px;margin:0 auto;padding-bottom:24px}
.wallet{width:85.6mm;min-height:54mm;box-sizing:border-box;padding:5mm 6mm;border:1px solid var(--ink);border-radius:3mm;
        background:var(--surface);color:var(--ink);font-size:8.5pt;line-height:1.35;break-inside:avoid}
.wallet .w-name{font-weight:700;font-size:11pt;line-height:1.2}
.wallet .w-sub{color:var(--muted)}
.wallet .w-alert{margin-top:2px;padding:1.5mm 2mm;border:1px solid var(--crit);border-radius:1.5mm;color:var(--crit)}
.wallet .w-rule{border-top:1px solid var(--rule);margin:2mm 0}
.wallet .w-eyebrow{font-size:6.5pt;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-bottom:1mm}
.wallet .spread{display:flex;justify-content:space-between;gap:4mm}
.wallet .w-foot{margin-top:3mm;color:var(--muted);font-size:6.5pt}
@media print{
  .wallet{border-color:#000;background:#fff;color:#000}
  .wallet .w-alert{color:#000;border-color:#000}
  .wallet .w-sub,.wallet .w-eyebrow,.wallet .w-foot{color:#333}
}

/* Shared report, opened in the page. A report is read, not filed away, so it
   fills the screen rather than the 560px drawer the record's own panels use —
   a portrait page in that width is unreadable. The frame carries the browser's
   own PDF viewer; Download stays available for anyone who does want the file. */
.docview{position:fixed;inset:0;z-index:50;display:flex;flex-direction:column;background:var(--surface)}
.docview-h{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--rule);flex-wrap:wrap}
.docview-h .t{font-weight:700;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.docview-h .sp{margin-left:auto;display:flex;gap:8px;align-items:center}
.docview-b{flex:1;min-height:0;background:var(--surface-2)}
.docview-b iframe{display:block;width:100%;height:100%;border:0;background:var(--surface-2)}
.docview-b pre{margin:0;height:100%;overflow:auto;padding:18px;font-size:13px;line-height:1.5;white-space:pre-wrap;word-break:break-word;color:var(--ink)}
@media (max-width:520px){.docview-h{padding:10px 12px}.docview-h .t{flex:1 1 100%}}
/* A report drawn by PDF.js: pages down the middle, scrolling in the pane. */
.pdf-pages{height:100%;overflow:auto;-webkit-overflow-scrolling:touch;padding:12px;display:flex;flex-direction:column;align-items:center;gap:12px}
.pdf-pages .pdf-page{max-width:100%;height:auto !important;background:#fff;box-shadow:var(--shadow);border-radius:2px}
.pdf-pages:empty::before{content:"Loading the report…";margin:auto;color:var(--muted);font-size:14px}
.doc-problem{max-width:520px;margin:48px auto;padding:18px 20px;display:grid;gap:6px;background:var(--surface);border:1px solid var(--rule);border-radius:12px;color:var(--ink);font-size:14px}
