/* Mom Care: one token layer over Bootstrap, in the CareCircle look (navy sidebar, white cards on a light
   ground, blue / teal / green / amber / red). Loaded after bootstrap.min.css, so it overrides
   Bootstrap's CSS variables rather than fighting its selectors. See ADR-026.

   Two deliberate departures from the mockup, both for readability by older family members:
   text is never smaller than about 12px (the mockup goes down to 10px), and the blue, green and red
   used for TEXT and BUTTONS are a shade darker than the decorative ones so white-on-colour and
   colour-on-tint pass 4.5:1 contrast. The exact mockup colours are used for everything decorative. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/AtkinsonHyperlegibleNext-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* mockup palette (decorative) */
  --mc-nav: #16324f;
  --mc-nav-2: #214968;
  --mc-nav-hover: #244a67;
  --mc-blue: #2f80ed;
  --mc-teal: #16a6a0;
  --mc-green: #32a852;
  --mc-amber: #e5a72f;
  --mc-red: #d9534f;
  --mc-bg: #f5f7fa;
  --mc-card: #ffffff;

  /* text and controls (contrast-safe) */
  --mc-ink: #243447;
  --mc-muted: #5f6f83;
  --mc-line: #e4e9ef;
  --mc-line-strong: #c9d3de;
  --mc-wash: #f5f7fa;
  --mc-accent: #1f6fd8;
  --mc-accent-hover: #1859b3;
  --mc-accent-tint: #eaf3ff;
  --mc-accent-ink: #1a5fb4;
  --mc-attention: #b43d39;
  --mc-attention-tint: #fdecec;
  --mc-ok: #1e7a35;
  --mc-ok-tint: #e9f7ed;
  --mc-warn-tint: #fff5dd;
  --mc-warn-ink: #855a00;
  --mc-avatar-bg: #d9eef0;
  --mc-avatar-ink: #0f6f6c;
  --mc-shadow: 0 1px 2px rgba(20, 40, 60, 0.04);

  --bs-body-font-family: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--mc-ink);
  --bs-body-bg: var(--mc-bg);
  --bs-secondary-color: var(--mc-muted);
  --bs-border-color: var(--mc-line);
  --bs-link-color: var(--mc-accent);
  --bs-link-color-rgb: 31, 111, 216;
  --bs-link-hover-color: var(--mc-accent-hover);
  --bs-link-hover-color-rgb: 24, 89, 179;
  --bs-danger: var(--mc-attention);
  --bs-danger-rgb: 180, 61, 57;
  color-scheme: light;
}

html { font-size: 16px; }

body {
  background: var(--mc-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* ---------- type ---------- */
h1, .h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
h2, .h2 { font-size: 1.15rem; font-weight: 700; line-height: 1.3; }
h3, .h3 { font-size: 1.05rem; font-weight: 700; }
h4, .h4, h5, .h5 { font-weight: 700; }
h1, h2 { overflow-wrap: anywhere; }
.text-muted { color: var(--mc-muted) !important; }
a { text-underline-offset: 0.18em; }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--mc-blue);
  outline-offset: 2px;
  box-shadow: none;
}

/* ---------- shell: sidebar + top bar ---------- */
.app { min-height: 100vh; }
.main { min-width: 0; }

.sidebar {
  --bs-offcanvas-width: 17rem;
  --bs-offcanvas-bg: var(--mc-nav);
  --bs-offcanvas-color: #dce8f2;
  --bs-offcanvas-border-width: 0;
  background: var(--mc-nav);
  color: #dce8f2;
}
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 1.4rem 0.95rem 1.1rem; overflow-y: auto; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.6rem 1.6rem; }
.sidebar :focus-visible { outline-color: #fff; }

.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-size: 1.3rem; font-weight: 700; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: 2.2rem; height: 2.2rem; border-radius: 0.7rem; background: #fff; color: var(--mc-teal); display: grid; place-items: center; font-weight: 900; }

.nav-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.09em; color: #9bb2c6; padding: 0.9rem 0.75rem 0.4rem; }
.nav-list a {
  display: flex; align-items: center; gap: 0.75rem;
  color: #cbd9e5; text-decoration: none;
  padding: 0.65rem 0.75rem; min-height: 44px;
  border-radius: 0.6rem; margin: 2px 0;
  font-size: 0.97rem;
}
.nav-list a:hover, .nav-list a.active { background: var(--mc-nav-hover); color: #fff; }
.nav-list a.active { font-weight: 700; }
.nav-icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; opacity: 0.92; }
.sidebar-footer { margin-top: auto; background: var(--mc-nav-2); border-radius: 0.8rem; padding: 0.85rem 0.95rem; font-size: 0.85rem; line-height: 1.45; color: #dce8f2; }

@media (min-width: 992px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 15.5rem !important; z-index: 20; background-color: var(--mc-nav) !important; visibility: visible !important; transform: none !important; }
  .main { margin-left: 15.5rem; }
}

.topbar {
  height: 4.4rem; background: #fff; border-bottom: 1px solid var(--mc-line);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1.75rem; position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 1rem; flex: none; }
.menu-toggle { width: 2.75rem; height: 2.75rem; flex: none; display: grid; place-items: center; background: #fff; border: 1px solid var(--mc-line-strong); border-radius: 0.65rem; color: var(--mc-ink); }
.menu-toggle svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.parent-select { display: flex; align-items: center; gap: 0.7rem; color: var(--mc-ink); text-decoration: none; min-width: 0; }
.select-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.select-text small { color: var(--mc-muted); font-size: 0.78rem; }
.select-text strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mc-me { display: inline-flex; align-items: center; gap: 0.6rem; background: none; border: 0; padding: 0.2rem 0.35rem; border-radius: 999px; color: var(--mc-ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.mc-me:hover .avatar { box-shadow: 0 0 0 2px var(--mc-blue); }
.mc-user-menu .dropdown-menu { min-width: 13.5rem; border-color: var(--mc-line); border-radius: 0.7rem; box-shadow: 0 8px 24px rgba(20, 40, 60, 0.12); }
.mc-user-menu .dropdown-item { min-height: 2.6rem; display: flex; align-items: center; }
.mc-user-menu .dropdown-header { color: var(--mc-muted); }

.content { padding: 1.65rem 1.9rem 3rem; max-width: 94rem; margin: 0 auto; }
.page-card { background: var(--mc-card); border: 1px solid var(--mc-line); border-radius: 0.8rem; padding: 1.5rem 1.65rem; box-shadow: var(--mc-shadow); max-width: 64rem; }

/* signed-out pages (log in, sign-in code) */
.auth-shell { min-height: 100vh; background: var(--mc-nav); display: flex; flex-direction: column; align-items: center; gap: 1.5rem; padding: 2.25rem 1rem; }
.auth-card { background: #fff; border-radius: 0.9rem; padding: 1.75rem; width: min(100%, 32rem); }

/* ---------- page structure ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.page-lede { color: var(--mc-muted); max-width: 60ch; margin: -0.5rem 0 1.5rem; }

.list-filter { margin: 0 0 0.5rem; padding-left: 1.75em; min-height: 0; }
.list-filter .form-check-label { color: var(--mc-muted); }

.section { margin-top: 2.25rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.5rem; }
.section-head a { font-weight: 600; }

/* ---------- lists & tables ---------- */
/* position: relative makes the wrapper the containing block for the visually-hidden header text;
   otherwise that text escapes the scroll clipping and widens the whole page on phones. */
.table-wrap { overflow-x: auto; position: relative; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--mc-ink); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.85rem 0.75rem; border-bottom: 1px solid var(--mc-line); background: transparent; }
.table > thead > tr > th { color: var(--mc-muted); font-weight: 600; font-size: 0.88rem; border-bottom: 1px solid var(--mc-line-strong); white-space: nowrap; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table td:first-child, .table th:first-child { padding-left: 0; }
.table td:last-child, .table th:last-child { padding-right: 0; text-align: right; }
.table td { overflow-wrap: break-word; }
.table td.cell-wrap { overflow-wrap: anywhere; }
.table td:last-child:has(form, .row-action) { white-space: nowrap; overflow-wrap: normal; }
.row-action { font-weight: 600; white-space: nowrap; }
.cell-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--mc-line); }
.plain-list > li:last-child { border-bottom: 0; }
.plain-list > li > * { min-width: 0; overflow-wrap: anywhere; }
.plain-list > li > .when { color: var(--mc-muted); text-align: right; white-space: nowrap; flex-shrink: 0; overflow-wrap: normal; }
.plain-list .sub { display: block; color: var(--mc-muted); font-size: 0.9rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem 2rem; margin: 0 0 1.25rem; }
.facts dt { color: var(--mc-muted); font-size: 0.9rem; font-weight: 600; }
.facts dd { margin: 0; }
.profile-notes { max-width: 65ch; white-space: pre-line; }
.plain-list > li > .with-action { display: flex; align-items: baseline; justify-content: flex-end; gap: 0.9rem; }
.with-action .stack { display: flex; flex-direction: column; align-items: flex-end; }

.day-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-bottom: 1rem; font-weight: 600; }
.log-list > li { justify-content: flex-start; gap: 1.25rem; }
.plain-list > li > .log-time { color: var(--mc-muted); min-width: 4.75rem; flex-shrink: 0; white-space: nowrap; }
.log-body { flex: 1; min-width: 0; }
.log-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.log-meta { margin: 0.25rem 0 0; color: var(--mc-muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.9rem; }
.profile-id { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.profile-id > div { min-width: 0; }
.profile-photo { width: 5.5rem; height: 5.5rem; object-fit: cover; border-radius: 50%; background: var(--mc-line); display: block; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.filter-chips a { padding: 0.3rem 0.85rem; border: 1px solid var(--mc-line-strong); border-radius: 999px; color: var(--mc-muted); font-weight: 600; text-decoration: none; background: #fff; }
.filter-chips a:hover { color: var(--mc-ink); border-color: var(--mc-muted); }
.filter-chips a.active { background: var(--mc-accent); border-color: var(--mc-accent); color: #fff; }
.photo-tile .belongs { display: block; color: var(--mc-muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.log-photos { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.log-photos img { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 8px; background: var(--mc-line); display: block; }
.photo-link { margin: 0.75rem 0 0; font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-weight: 600; }
.photo-count { font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1.25rem; }
.photo-tile { display: block; text-decoration: none; color: var(--mc-ink); }
.photo-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--mc-line); display: block; }
.photo-tile .caption { display: block; margin-top: 0.4rem; font-size: 0.9rem; overflow-wrap: anywhere; }
.photo-tile:hover .caption { text-decoration: underline; }
.photo-full { max-width: 100%; max-height: 75vh; border-radius: 10px; background: var(--mc-line); }

.empty { color: var(--mc-muted); padding: 1.25rem 0; max-width: 55ch; }
.empty .btn { margin-top: 0.75rem; }

/* ---------- badges (the "chip" class is what the pages use) ---------- */
.chip { display: inline-block; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; line-height: 1.5; background: #eef1f4; color: var(--mc-muted); white-space: nowrap; }
.chip-ok { background: var(--mc-ok-tint); color: var(--mc-ok); }
.chip-attention { background: var(--mc-attention-tint); color: var(--mc-attention); }
.chip-accent { background: var(--mc-accent-tint); color: var(--mc-accent-ink); }
.chip-warn { background: var(--mc-warn-tint); color: var(--mc-warn-ink); }

/* ---------- buttons ---------- */
.btn { --bs-btn-border-radius: 0.55rem; --bs-btn-font-weight: 600; --bs-btn-padding-x: 1.1rem; --bs-btn-padding-y: 0.5rem; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; }
.btn-sm { --bs-btn-padding-x: 0.85rem; --bs-btn-padding-y: 0.3rem; --bs-btn-font-size: 0.95rem; min-height: 2.4rem; }
.btn-primary {
  --bs-btn-bg: var(--mc-accent); --bs-btn-border-color: var(--mc-accent); --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--mc-accent-hover); --bs-btn-hover-border-color: var(--mc-accent-hover); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--mc-accent-hover); --bs-btn-active-border-color: var(--mc-accent-hover); --bs-btn-active-color: #fff;
}
.btn-success {
  --bs-btn-bg: var(--mc-ok); --bs-btn-border-color: var(--mc-ok); --bs-btn-color: #fff;
  --bs-btn-hover-bg: #17632a; --bs-btn-hover-border-color: #17632a; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #17632a; --bs-btn-active-border-color: #17632a; --bs-btn-active-color: #fff;
}
.btn-outline-primary, .btn-outline-secondary {
  --bs-btn-color: var(--mc-ink); --bs-btn-border-color: var(--mc-line-strong); --bs-btn-bg: #fff;
  --bs-btn-hover-color: var(--mc-ink); --bs-btn-hover-bg: var(--mc-wash); --bs-btn-hover-border-color: var(--mc-muted);
  --bs-btn-active-color: var(--mc-ink); --bs-btn-active-bg: var(--mc-wash); --bs-btn-active-border-color: var(--mc-muted);
}
.btn-link { --bs-btn-font-weight: 600; }

/* ---------- forms ---------- */
.form-label { font-weight: 600; margin-bottom: 0.3rem; }
.form-control, .form-select { border-color: var(--mc-line-strong); border-radius: 0.55rem; min-height: 2.75rem; padding: 0.5rem 0.8rem; }
textarea.form-control { min-height: 0; }
.form-control:focus, .form-select:focus { border-color: var(--mc-blue); box-shadow: 0 0 0 3px var(--mc-accent-tint); }
.form-check-input { border-color: var(--mc-line-strong); }
.form-check-input:checked { background-color: var(--mc-accent); border-color: var(--mc-accent); }
.form-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; }
.form-hint { color: var(--mc-muted); font-size: 0.9rem; margin-top: 0.3rem; }
.text-danger, .field-validation-error, .validation-summary-errors { color: var(--mc-attention) !important; }
.validation-summary-errors ul { padding-left: 1.1rem; margin-bottom: 1rem; }
.validation-summary-valid { display: none; }

.aside-action { margin-top: 2.25rem; padding-top: 1.25rem; border-top: 1px solid var(--mc-line); }
.aside-action p { max-width: 55ch; color: var(--mc-muted); margin-bottom: 0.75rem; font-size: 0.95rem; }

/* ---------- zoomable photo viewer ---------- */
.zoom-viewer { margin-bottom: 1rem; }
.zoom-toolbar { display: none; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.zoom-toolbar .btn { min-width: 44px; padding-inline: 0.9rem; }
.zoom-toolbar .btn-symbol { font-size: 1.35rem; line-height: 1; font-weight: 600; }
.zoom-hint { display: none; margin-top: 0.5rem; }
.zoom-stage { position: relative; overflow: hidden; border-radius: 10px; background: var(--mc-line); }
.zoom-img { display: block; max-width: 100%; height: auto; border-radius: 10px; -webkit-user-drag: none; user-select: none; }

/* Once the script has sized the image, the stage becomes a fixed frame the photo is moved inside. */
.zoom-viewer.is-ready .zoom-toolbar { display: flex; }
.zoom-viewer.is-ready .zoom-hint { display: block; }
.zoom-viewer.is-ready .zoom-stage { width: 100%; height: auto; max-height: min(75vh, 46rem); background: #0e151c; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.zoom-viewer.is-ready .zoom-stage.is-grabbing { cursor: grabbing; }
.zoom-viewer.is-ready .zoom-stage:focus-visible { outline: 3px solid var(--mc-blue); outline-offset: 2px; }
.zoom-viewer.is-ready .zoom-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; border-radius: 0; will-change: transform; }

/* Full screen (a plain CSS overlay, so it works on phones that don't support the Fullscreen API). */
.zoom-viewer.is-full { position: fixed; inset: 0; z-index: 1080; margin: 0; padding: calc(env(safe-area-inset-top, 0px) + 0.75rem) 0.75rem calc(env(safe-area-inset-bottom, 0px) + 0.75rem); background: #0b1117; display: flex; flex-direction: column; }
.zoom-viewer.is-full .zoom-stage { flex: 1; height: auto; max-height: none; aspect-ratio: auto !important; border-radius: 0; }
.zoom-viewer.is-full .zoom-hint { color: #b7c3cf; margin-bottom: 0; }
.zoom-viewer.is-full .zoom-toolbar .btn { background: var(--mc-nav); color: #fff; border-color: #3a5a78; }
.zoom-viewer.is-full .zoom-toolbar .btn:disabled { opacity: 0.45; }
html.zoom-lock, html.zoom-lock body { overflow: hidden; }

/* ---------- avatars (ADR-024) ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--mc-avatar-bg); vertical-align: middle; }
.avatar-xs { width: 1.5rem; height: 1.5rem; }
.avatar-sm { width: 1.9rem; height: 1.9rem; }
.avatar-md { width: 2.4rem; height: 2.4rem; }
.avatar-lg { width: 6rem; height: 6rem; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; color: var(--mc-avatar-ink); font-weight: 700; line-height: 1; }
.avatar-xs.avatar-initials { font-size: 0.65rem; }
.avatar-sm.avatar-initials { font-size: 0.8rem; }
.avatar-md.avatar-initials { font-size: 0.9rem; }
.avatar-lg.avatar-initials { font-size: 2rem; }
.log-author { display: inline-flex; align-items: center; gap: 0.4rem; }
.me-current { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }

/* The QR code is drawn on its own white square, so it scans on any background. */
#qrCode svg { width: min(13rem, 100%); height: auto; display: block; border: 1px solid var(--mc-line); border-radius: 8px; }

/* ---------- alerts ---------- */
.alert { border-radius: 0.7rem; border: 0; padding: 1rem 1.2rem; }
.alert-danger { background: var(--mc-attention-tint); color: var(--mc-ink); }
.alert-success { background: var(--mc-ok-tint); color: var(--mc-ink); }
.alert-info { background: var(--mc-accent-tint); color: var(--mc-ink); }
.alert-warning { background: #fff7e6; color: var(--mc-ink); }
.alert .table { --bs-table-color: var(--mc-ink); }
.alert-danger .table > :not(caption) > * > * { border-bottom-color: rgba(180, 61, 57, 0.18); }

/* ---------- dashboard cards ---------- */
.dash-welcome { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.35rem; }
.dash-welcome .subtitle { color: var(--mc-muted); margin-top: 0.3rem; }

.mc-card { background: var(--mc-card); border: 1px solid var(--mc-line); border-radius: 0.8rem; padding: 1.1rem 1.2rem; box-shadow: var(--mc-shadow); min-width: 0; }
.mc-card > .card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.mc-card > .card-head h2 { margin: 0; font-size: 1.05rem; }
.mc-card .link { font-size: 0.88rem; font-weight: 600; text-decoration: none; }
.mc-card .link:hover { text-decoration: underline; }
.mc-card .empty { padding: 0.4rem 0; }

.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.stat-label { font-size: 0.85rem; color: var(--mc-muted); margin-bottom: 0.4rem; }
.stat-value { font-size: 1.75rem; font-weight: 750; line-height: 1.1; overflow-wrap: anywhere; }
.stat-value.is-small { font-size: 1.35rem; }
.stat-note { font-size: 0.82rem; margin-top: 0.45rem; color: var(--mc-muted); }
.stat-note.is-good { color: var(--mc-ok); }
.stat-note.is-alert { color: var(--mc-attention); font-weight: 600; }
.stat-icon { width: 2.5rem; height: 2.5rem; border-radius: 0.65rem; display: grid; place-items: center; background: var(--mc-accent-tint); color: var(--mc-blue); flex: none; }
.stat-icon svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon.is-good { background: var(--mc-ok-tint); color: var(--mc-green); }
.stat-icon.is-alert { background: var(--mc-attention-tint); color: var(--mc-red); }
.stat-icon.is-teal { background: #e3f5f4; color: var(--mc-teal); }

.dash-alert { display: flex; gap: 0.8rem; align-items: flex-start; background: #fff7e6; border: 1px solid #f4dfad; border-radius: 0.65rem; padding: 0.9rem 1.05rem; margin-top: 1rem; color: #6b5217; }
.dash-alert svg { width: 1.3rem; height: 1.3rem; flex: none; fill: none; stroke: #b47b09; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; margin-top: 0.1rem; }
.dash-alert strong { display: block; color: #5a430f; }
.dash-alert p { margin: 0.15rem 0 0; font-size: 0.92rem; }
.dash-alert a { color: inherit; font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 1rem; margin-top: 1rem; align-items: start; }
.span-2 { grid-column: span 2; }

.attention-panel { background: var(--mc-attention-tint); border-color: #f3cccb; }
.attention-panel h2 { color: var(--mc-attention); }
.attention-panel .plain-list > li { border-bottom-color: rgba(180, 61, 57, 0.18); align-items: center; }
.dose-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

.task { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0; border-bottom: 1px solid #eef1f4; }
.task:last-child { border-bottom: 0; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-meta { font-size: 0.85rem; color: var(--mc-muted); margin-top: 0.15rem; }

.appointment { display: flex; gap: 0.85rem; padding: 0.7rem 0; border-bottom: 1px solid #eef1f4; }
.appointment:last-child { border-bottom: 0; }
.date-box { width: 3.1rem; text-align: center; border: 1px solid var(--mc-line); border-radius: 0.55rem; overflow: hidden; flex: none; align-self: flex-start; }
.date-box b { display: block; background: #edf4fb; color: #3f6685; font-size: 0.72rem; padding: 0.2rem; letter-spacing: 0.04em; }
.date-box strong { display: block; padding: 0.25rem; font-size: 1.15rem; }
.appt-info { min-width: 0; }
.appt-info strong { display: block; overflow-wrap: anywhere; }
.appt-info span { display: block; font-size: 0.85rem; color: var(--mc-muted); margin-top: 0.15rem; }

.team { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid #eef1f4; }
.team:last-child { border-bottom: 0; }
.person { flex: 1; min-width: 0; }
.person strong { display: block; overflow-wrap: anywhere; }
.person span { font-size: 0.85rem; color: var(--mc-muted); }

.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ""; position: absolute; left: 0.45rem; top: 0.35rem; bottom: 0.35rem; width: 2px; background: #e6ebef; }
.event { position: relative; padding: 0 0 1rem; }
.event:last-child { padding-bottom: 0; }
.event::before { content: ""; position: absolute; left: -1.45rem; top: 0.4rem; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--mc-blue); border: 3px solid #eaf3ff; box-sizing: content-box; }
.event p { margin: 0.15rem 0; color: var(--mc-ink); white-space: pre-line; overflow-wrap: anywhere; }
.event time { font-size: 0.82rem; color: var(--mc-muted); }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.3rem; }
.cal-dow { text-align: center; font-size: 0.72rem; color: var(--mc-muted); padding: 0.25rem 0; letter-spacing: 0.04em; }
.cal-day { height: 2.1rem; display: grid; place-items: center; border-radius: 0.5rem; font-size: 0.88rem; }
.cal-day.is-today { background: var(--mc-accent); color: #fff; font-weight: 700; }
.cal-day.has-event { background: #e3f5f4; color: var(--mc-avatar-ink); font-weight: 700; }
.cal-day.is-today.has-event { background: var(--mc-accent); color: #fff; box-shadow: 0 0 0 2px #e3f5f4 inset; }
.cal-legend { display: flex; gap: 1rem; margin-top: 0.7rem; font-size: 0.8rem; color: var(--mc-muted); }
.cal-legend i { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 0.2rem; margin-right: 0.35rem; vertical-align: -0.05rem; }

/* ---------- responsive ---------- */
@media (max-width: 1199.98px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 991.98px) {
  .topbar { padding: 0 1rem; }
  .content { padding: 1.25rem 1rem 2.5rem; }
}
@media (max-width: 767.98px) {
  .dash-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 575.98px) {
  .page-card { padding: 1.1rem 1rem; border-radius: 0.7rem; }
  h1, .h1 { font-size: 1.5rem; }
  .plain-list > li { flex-direction: column; gap: 0.25rem; }
  .log-list > li { flex-direction: row; gap: 0.9rem; }
  .plain-list .when { text-align: left; }
  .plain-list > li > .with-action { justify-content: flex-start; }
  .with-action .stack { align-items: flex-start; }
  .attention-panel .plain-list > li { align-items: flex-start; }
  .dose-actions { justify-content: flex-start; }
  .dash-stats { gap: 0.75rem; }
  .dash-stats .mc-card { padding: 0.9rem; }
  .stat-icon { display: none; }
  .stat-value { font-size: 1.5rem; }
}
@media (max-width: 340px) {
  .dash-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ---------- touch targets ----------
   44px is the size Apple and Google recommend for anything tapped with a finger. Applied on
   touch screens and on narrow screens, so desktop keeps its compact look. */
@media (pointer: coarse), (max-width: 575.98px) {
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .row-action, .section-head a, .day-nav a, .photo-link a, .photo-count, .form-actions .btn-link, .mc-card .link {
    display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0.4rem;
  }
  .row-action { min-width: 44px; justify-content: center; }
  .table a.row-action { margin-inline: -0.4rem; }
  a[href^="tel:"], a[href^="mailto:"], .back-link { display: inline-flex; align-items: center; min-height: 44px; }
  .mc-me { min-height: 44px; }
  .list-filter { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; padding-left: 0; }
  .list-filter .form-check-input { width: 1.4rem; height: 1.4rem; margin: 0; flex-shrink: 0; }
  .list-filter .form-check-label { flex: 1; min-height: 44px; display: flex; align-items: center; }
  .filter-chips a { display: inline-flex; align-items: center; min-height: 44px; }
  .form-check-input { width: 1.35rem; height: 1.35rem; }
  .form-check-inline { min-height: 44px; display: inline-flex; align-items: center; gap: 0.35rem; }
  .form-check-inline .form-check-input { margin: 0; }
}

/* Doctor-visit page (Pages/Profile/OnePager): on screen, in "show" mode on a phone or tablet, and printed. */
.onepager { max-width: 52rem; margin: 0 auto; }
.onepager-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; margin-bottom: 1rem; }
.onepager-head h1 { margin-bottom: 0.15rem; }
.onepager-sub { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; color: var(--mc-muted); }
.onepager-asof { margin: 0.25rem 0 0; font-size: 0.9rem; color: var(--mc-muted); }
.onepager section { margin-top: 1.25rem; }
.onepager h2 { font-size: 1.1rem; border-bottom: 2px solid var(--mc-line-strong); padding-bottom: 0.25rem; margin-bottom: 0.5rem; }
.onepager ul { margin: 0; padding-left: 1.2rem; }
.onepager-table th { font-size: 0.9rem; color: var(--mc-muted); }
.onepager-note { font-size: 0.9rem; color: var(--mc-muted); }
.onepager-policy { margin-bottom: 1rem; }
.onepager-cards { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.onepager-cards img { display: block; max-width: 100%; max-height: 14rem; border: 1px solid var(--mc-line-strong); border-radius: 0.5rem; }
.onepager-show { font-size: 1.15rem; }
.onepager-show .onepager-cards img { max-height: 22rem; }
.bare-shell { min-height: 100vh; padding: 1rem; background: #fff; }

@media print {
  .sidebar, .topbar, .no-print, .skip-link, .alert { display: none !important; }
  body { background: #fff !important; color: #000; font-size: 11pt; }
  .main { margin-left: 0 !important; }
  .content, .bare-shell { padding: 0 !important; }
  .page-card { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .onepager { max-width: none; }
  .onepager a { color: inherit; text-decoration: none; }
  .onepager-sub, .onepager-asof, .onepager-note, .onepager .text-muted { color: #333 !important; }
  .onepager-cards img { max-height: 7cm; }
  .onepager section, .onepager-policy, .onepager-table tr { break-inside: avoid; }
}


/* Dose history grid (Medications/History) */
.history-table th, .history-table td { white-space: nowrap; vertical-align: middle; }
.history-table tbody th { white-space: normal; min-width: 8rem; }
.dose-mark { display: inline-block; min-width: 1.6rem; margin: 1px 1px; padding: 0 0.35rem; border-radius: 6px; font-weight: 700; line-height: 1.6; background: #eef1f4; color: var(--mc-muted); }
.dose-taken { background: var(--mc-ok-tint); color: var(--mc-ok); }
.dose-notrecorded, .dose-missed { background: var(--mc-attention-tint); color: var(--mc-attention); }
.history-legend span { margin-right: 1rem; white-space: nowrap; }
@media print {
  .history-table { font-size: 10pt; }
  .dose-mark { border: 1px solid #666; background: #fff !important; color: #000 !important; }
}
