/* Care features (SOS, health metrics, medication, documents, approvals, settings).
   Built only from the dashboard's existing tokens; fallbacks keep the SOS working on the card view too. */

/* ---------- SOS: fixed on every view ---------- */
.cr-sos { position: fixed; right: 16px; bottom: 16px; z-index: 250; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; max-width: calc(100vw - 32px); }
.cr-sos-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; min-height: 64px; padding: 0 24px 0 18px; border: 3px solid #fff; border-radius: 999px; background: #c62828; color: #fff; font: inherit; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.cr-sos-btn:hover { background: #b71c1c; }
.cr-sos-btn:focus-visible { outline: 4px solid var(--focus, #0b6bcb); outline-offset: 3px; }
.cr-sos-in { position: relative; display: inline-flex; align-items: center; gap: 12px; }
.cr-sos-in .ic { width: 30px; height: 30px; stroke-width: 2.2; }
.cr-sos-t { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; text-align: left; }
.cr-sos-t b { font-size: 1.35rem; letter-spacing: .04em; }
.cr-sos-t small { font-size: .85rem; font-weight: 600; }
.cr-sos-fill { position: absolute; inset: 0; background: rgba(255, 255, 255, .35); transform: scaleX(0); transform-origin: left; }
.cr-sos.is-active .cr-sos-btn { background: #8e1c1c; }
.cr-sos-st { width: min(340px, 100%); padding: 14px 16px; border: 2px solid #c62828; border-radius: 12px; background: var(--surface, #fff); color: var(--text, #1a2730); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.cr-sos-st h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 0 0 6px; }
.cr-sos-st h2 .ic { color: #c62828; }
.cr-sos-state { margin: 0 0 8px; font-size: .95rem; }
.cr-sos-steps { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .9rem; }
.cr-sos-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted, #55636d); }
.cr-sos-steps li.done { color: var(--text, #1a2730); font-weight: 600; }
.cr-sos-steps .ic { width: 18px; height: 18px; color: var(--l0, #23825a); }
.cr-dot { width: 12px; height: 12px; margin: 0 3px; border-radius: 50%; border: 2px solid var(--line-2, #c8d2d9); }
.cr-sos-go { background: #c62828; color: #fff; border-color: #c62828; }
.cr-sos-go:hover { background: #b71c1c; }
body.sd, body.cd { padding-bottom: 96px; }

/* ---------- shared pieces: dialog, snackbar, rows ---------- */
.cr-dlg { width: min(100% - 32px, 560px); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 12px; background: var(--surface, #fff); color: var(--text, #1a2730); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.cr-dlg::backdrop { background: rgba(12, 21, 27, .55); }
.cr-dlg .dlg-bar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--surface, #fff); border-bottom: 1px solid var(--line, #dde4e9); }
.cr-dlg .dlg-bar h2 { margin: 0; font-size: 1.1rem; }
.cr-dlg .dlg-body { padding: 20px; }
.cr-dlg .tool { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.cr-dlg .ic, .cr-sos .ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cr-dlg .chip, .cr-sos .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--sunk, #f2f5f7); color: var(--muted, #55636d); border: 1px solid var(--line, #dde4e9); }
.cr-dlg .chip-warn, .cr-sos .chip-warn { color: var(--l1, #a3630d); }
.cr-dlg .chip-ok, .cr-sos .chip-ok { color: var(--l0, #23825a); }
.cr-dlg .chip-seen, .cr-sos .chip-seen { color: var(--pri, #1f7a6f); }
.cr-dlg .chip-bad { color: var(--l2, #b4501a); }
.cr-dlg .dl > div { display: grid; gap: 2px; margin-bottom: 8px; }
.cr-dlg .dl dt { color: var(--muted, #55636d); font-size: .8rem; font-weight: 700; }
.cr-dlg .dl dd { margin: 0; }
.cr-dlg .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1.5px solid var(--line-2, #c8d2d9); border-radius: 8px; background: var(--surface, #fff); color: var(--text, #1a2730); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.cr-dlg .btn-pri { background: var(--pri-bg, #1f7a6f); border-color: transparent; color: #fff; }
.cr-dlg .cr-sos-go { background: #c62828; border-color: #c62828; color: #fff; }
.cr-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cr-snack { position: fixed; left: 50%; bottom: 96px; z-index: 260; display: none; align-items: center; gap: 14px; max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 10px; background: var(--text, #1a2730); color: var(--bg, #fff); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); transform: translateX(-50%); font-size: .95rem; }
.cr-snack.on { display: flex; }
.cr-undo { background: transparent; color: inherit; border: 1.5px solid currentColor; }
.cr-big { font-size: 1.35rem; font-weight: 700; line-height: 1.35; margin-bottom: 8px; }
.cr-sum { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--sunk); font-size: .95rem; }
.cr-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--sunk); border: 1px solid var(--line); }
.cr-status .ic { width: 22px; height: 22px; }
.cr-ok { color: var(--l0); } .cr-warn { color: var(--l1); } .cr-bad { color: var(--l2); }
.cr-status span { color: var(--text); flex-basis: 100%; font-size: .92rem; }
.cr-status span:empty { display: none; }
.cr-list { display: grid; gap: 10px; margin-bottom: 12px; }
.cr-list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cr-list small, .cr-meds small { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; }
.cr-steps { padding-left: 1.2rem; display: grid; gap: 6px; list-style: decimal; }
.cr-steps li { list-style: decimal; }
.cr-form { display: grid; gap: 14px; }
.cr-form label:not(.chk) { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.cr-form input[type=text], .cr-form input[type=file] { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.cr-form fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 6px; }
.cr-form legend { padding: 0; margin-bottom: 4px; font-weight: 700; }
.cr-form .chk, .cr-req { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 500; }
.cr-form input[type=checkbox], .cr-form input[type=radio], .cr-req input { width: 22px; height: 22px; accent-color: var(--pri); }

/* ---------- overview slider ---------- */
.cr-slide { margin-bottom: 18px; }
.cr-slide-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cr-slide-h h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.cr-slide-b { display: flex; gap: 6px; }
.cr-slide-b .tool { width: 44px; height: 44px; border: 1px solid var(--line-2); background: var(--surface); }
.cr-flip { transform: scaleX(-1); }
.cr-slide-t { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; scrollbar-width: thin; }
.cr-card { flex: 0 0 min(260px, 78vw); scroll-snap-align: start; display: grid; gap: 8px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.cr-card-n { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); }
.cr-card-v { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.cr-card-a { font-weight: 600; }
.cr-card .chip { justify-self: start; }

/* ---------- debrief, health, medication ---------- */
.cr-qa { display: grid; gap: 10px; margin-top: 10px; }
.cr-qa li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); }
.cr-qa span { color: var(--muted); font-size: .95rem; }
.cr-metric-nav { margin-bottom: 14px; overflow-x: auto; }
.cr-tabs { flex-wrap: wrap; }
.cr-tabs button { min-height: 40px; padding: 4px 14px; }
.cr-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cr-meds { display: grid; gap: 10px; }
.cr-med { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.cr-med .cr-req { grid-column: 1 / -1; }

/* ---------- documents, approvals, products, alerts ---------- */
.cr-grp { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.cr-grp h3 { margin: 0; }
.cr-grp-b { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 14px; border: 0; background: var(--sunk); color: var(--text); font-weight: 700; text-align: left; }
.cr-grp-b span { flex: 1; }
.cr-grp-b small { color: var(--muted); }
.cr-chev { transition: transform .2s; transform: rotate(180deg); }
.cr-grp-b[aria-expanded="true"] .cr-chev { transform: none; }
.cr-grp-p { padding: 12px 14px; display: grid; gap: 14px; }
.cr-doc header, .cr-ap p:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cr-doc + .cr-doc { padding-top: 14px; border-top: 1px solid var(--line); }
.cr-fields { margin: 8px 0; }
.cr-aps { display: grid; gap: 12px; }
.cr-ap { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.cr-prods { display: grid; gap: 12px; }
.cr-prod { display: flex; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.cr-prod-i { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--pri-soft); color: var(--pri); }
.cr-prod .ic { vertical-align: middle; margin-right: 4px; width: 16px; height: 16px; }
.cr-example { padding: 12px; border: 1px dashed var(--line-2); border-radius: 8px; }
.cr-urgs { display: grid; gap: 14px; }
.cr-urg { padding: 12px 14px; border: 1px solid var(--line); border-left-width: 6px; border-radius: 8px; }
.cr-urg.cr-bad { border-left-color: var(--l3); } .cr-urg.cr-warn { border-left-color: var(--l1); } .cr-urg.cr-ok { border-left-color: var(--l0); }
.cr-urg h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 1rem; color: var(--text); }
.cr-urg ul { display: grid; gap: 12px; }
.cr-urg-d { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 14px; margin-top: 6px; font-size: .9rem; }
.cr-urg-d dt { color: var(--muted); font-size: .8rem; font-weight: 700; }
.cr-addr .cr-row { margin-top: 6px; }
.cr-faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.cr-faq summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.cr-faq p { margin-top: 8px; }

.cr-form select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.cr-inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cr-filter { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 14px; }
.cr-urg-f { margin: 0 0 12px; }

/* ---------- menu button (three bars) and the large-label menu ---------- */
.cr-menu-btn { display: none; width: 48px; height: 48px; border: 1px solid var(--line-2); background: var(--surface); }
.cr-menu { position: fixed; inset: 0; z-index: 240; display: none; background: rgba(12, 21, 27, .55); }
.cr-menu.on { display: block; }
.cr-menu nav { position: absolute; left: 0; top: 0; bottom: 0; width: min(88vw, 360px); overflow-y: auto; padding: 14px 14px 110px; background: var(--surface); box-shadow: 8px 0 30px rgba(0, 0, 0, .3); }
.cr-menu-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cr-menu-h b { font-size: 1.1rem; }
.cr-menu a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 12px; border-radius: 8px; font-size: 1.1rem; font-weight: 600; color: var(--text); text-decoration: none; }
.cr-menu a[aria-current] { background: var(--pri-soft); color: var(--pri); box-shadow: inset 4px 0 0 var(--pri); }
@media (max-width: 980px) { .cr-menu-btn { display: inline-grid; } }
@media (max-width: 640px) { .cr-sos-btn { min-height: 60px; } .cr-med { grid-template-columns: 1fr; } }

/* ---------- settings choices: higher contrast and less movement (opt-in, not a new theme) ---------- */
:root[data-contrast="high"] { --text: #000; --muted: #1f2a31; --line: #5b6870; --line-2: #3d4950; --pri: #0f5a51; --pri-bg: #0f5a51; --focus: #0044cc; }
:root[data-contrast="high"][data-theme="dark"] { --text: #fff; --muted: #e1eaef; --line: #8aa0ad; --line-2: #a9bcc7; --pri: #7fe3d3; --focus: #ffd866; }
@media (prefers-color-scheme: dark) { :root[data-contrast="high"]:not([data-theme="light"]) { --text: #fff; --muted: #e1eaef; --line: #8aa0ad; --line-2: #a9bcc7; --pri: #7fe3d3; --focus: #ffd866; } }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { .cr-sos-fill, .cr-chev { transition: none; } }

/* larger touch targets for checkboxes and radios */
.cr-form input[type=checkbox], .cr-form input[type=radio], .cr-req input { width: 26px; height: 26px; }
.cr-form .chk, .cr-req { min-height: 48px; }
