/* Healthipulse app. Same brand as the landing page: leaf ink, mint paper, hibiscus, leaf green.
   Calm, plain, readable on small Android phones and in bright light (UX §39–40). */
@font-face { font-family: "Bitter"; src: url("/fonts/bitter.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fonts/dmsans.woff") format("woff"); font-weight: 100 1000; font-display: swap; }

:root {
  --ink: #0E2B25; --ink-soft: #3F5A53; --paper: #F4F8F6; --white: #fff; --hibiscus: #B3124F; --hibiscus-deep: #8E0C3D;
  --leaf: #1D6B53; --leaf-soft: #E3F0EA; --mist: #D8E6E0; --pollen: #F2B84B; --amber: #9A5B00; --amber-soft: #FFF3DB; --red-soft: #FCE8EF;
  --serif: "Bitter", Georgia, serif; --sans: "DM Sans", "Segoe UI", system-ui, sans-serif; --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-s: 6px; --r-m: 12px; --r-l: 18px; --shadow: 0 10px 30px -18px rgba(14, 43, 37, .45);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); overflow-x: clip; }
a { color: var(--leaf); text-underline-offset: .18em; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); margin: 0 0 .4em; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); font-weight: 720; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 680; }
h3 { font-size: 1.05rem; font-weight: 660; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 3px solid var(--hibiscus); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 50; border-radius: var(--r-s); }
.skip:focus { top: .5rem; }
.muted { color: var(--ink-soft); } .small { font-size: .875rem; } .mono { font-family: var(--mono); }
.warn-text { color: var(--hibiscus-deep); font-weight: 600; }
.nowrap { white-space: nowrap; } .num { text-align: right; font-variant-numeric: tabular-nums; }
.noscript { padding: 2rem; }

/* ---------- chrome ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem clamp(1rem, 3vw, 1.6rem);
  background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--mist); padding-top: max(.6rem, env(safe-area-inset-top)); }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 2.1rem; color: var(--ink); overflow: visible; } .brand-dot { fill: var(--hibiscus); }
.brand-word { font: 720 1.2rem/1 var(--serif); }
.topbar-right { display: flex; align-items: center; gap: .7rem; }
.emergency-link { color: #fff; background: var(--hibiscus); font-weight: 700; text-decoration: none; font-size: .85rem; padding: .35rem .7rem; border-radius: 999px; white-space: nowrap; }
.role-switch select { font: inherit; padding: .35rem .5rem; border-radius: var(--r-s); border: 1px solid var(--mist); background: #fff; }
.bell { position: relative; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; color: var(--ink); }
.bell svg { width: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bell-count { position: absolute; top: 0; right: 0; min-width: 1.2rem; height: 1.2rem; border-radius: 999px; background: var(--hibiscus); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; padding: 0 .25rem; }
.avatar { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; font-weight: 700; text-decoration: none; }
.layout { display: flex; min-height: calc(100vh - 3.6rem); }
.sidenav { width: 220px; flex: none; padding: 1.2rem .8rem; border-right: 1px solid var(--mist); background: #fff; position: sticky; top: 3.6rem; height: calc(100vh - 3.6rem); overflow-y: auto; }
.sidenav a { display: block; padding: .6rem .8rem; border-radius: var(--r-s); color: var(--ink); text-decoration: none; font-weight: 500; }
.sidenav a:hover { background: var(--leaf-soft); }
.sidenav a[aria-current] { background: var(--ink); color: #fff; }
.nav-role { font-size: .8rem; color: var(--ink-soft); margin: 0 .8rem .6rem; }
.outlet { flex: 1; padding: clamp(1rem, 3vw, 2rem); max-width: 1240px; margin: 0 auto; width: 100%; outline: none; padding-bottom: 6rem; }
.outlet[aria-busy] { opacity: .6; transition: opacity .2s .1s; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-around; background: #fff; border-top: 1px solid var(--mist); padding: .3rem .2rem max(.3rem, env(safe-area-inset-bottom)); }
.tabbar a { flex: 1; text-align: center; padding: .55rem 0; font-size: .72rem; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink-soft); text-decoration: none; border-radius: var(--r-s); }
.tabbar a[aria-current] { color: var(--hibiscus); background: var(--red-soft); }
@media (min-width: 900px) { .tabbar { position: sticky; top: 3.6rem; bottom: auto; justify-content: center; gap: .4rem; background: var(--paper); border-top: 0; border-bottom: 1px solid var(--mist); padding: .4rem; } .tabbar a { flex: none; padding: .5rem 1rem; font-size: .92rem; } .outlet { padding-bottom: 2rem; } }
@media (max-width: 899px) { .sidenav { display: none; } .signed-in .sidenav:not([hidden]) { display: flex; position: static; width: auto; height: auto; overflow-x: auto; flex-direction: row; gap: .2rem; padding: .4rem; border: 0; border-bottom: 1px solid var(--mist); } .signed-in .layout:has(.sidenav:not([hidden])) { flex-direction: column; } .nav-role { display: none; } .sidenav a { white-space: nowrap; } }

/* ---------- building blocks ---------- */
.page-head { margin-bottom: 1.4rem; }
.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }
.stack { display: grid; gap: 1rem; align-content: start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.between { justify-content: space-between; } .end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .8rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .5rem; margin-bottom: .6rem; }
.narrow { max-width: 38rem; }
.split-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.workbench { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .split-2, .workbench, .split-wide { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); padding: 1.1rem 1.2rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink-soft); }
.empty h1, .empty h2 { color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 2.75rem; padding: .55rem 1.05rem; border-radius: 999px; border: 1.5px solid var(--ink);
  background: #fff; color: var(--ink); font: 600 .95rem/1.1 var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--leaf-soft); color: var(--ink); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--hibiscus); border-color: var(--hibiscus); color: #fff; } .btn-primary:hover { background: var(--hibiscus-deep); color: #fff; }
.btn-danger { background: #fff; border-color: var(--hibiscus); color: var(--hibiscus); } .btn-danger:hover { background: var(--hibiscus); color: #fff; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--leaf); } .btn-quiet:hover { background: var(--leaf-soft); }
.btn-small { min-height: 2.2rem; padding: .35rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; } .btn-big { min-height: 3.3rem; font-size: 1.05rem; padding: .8rem 1.4rem; }
.btn.on, .segmented .on { background: var(--ink); color: #fff; border-color: var(--ink); }

label { display: grid; gap: .3rem; font-weight: 600; font-size: .95rem; }
input, select, textarea { font: 400 1rem/1.4 var(--sans); color: var(--ink); background: #fff; border: 1.5px solid var(--mist); border-radius: var(--r-s); padding: .6rem .7rem; width: 100%; min-height: 2.75rem; }
input:focus, select:focus, textarea:focus { border-color: var(--leaf); outline: 2px solid color-mix(in srgb, var(--leaf) 30%, transparent); }
[aria-invalid] { border-color: var(--hibiscus); }
.field-error { color: var(--hibiscus-deep); font-size: .85rem; font-weight: 600; margin: .15rem 0 0; }
.hint { font-weight: 400; font-size: .85rem; color: var(--ink-soft); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .3rem; } legend { font-weight: 600; margin-bottom: .3rem; }
.check { display: flex; align-items: flex-start; gap: .55rem; font-weight: 500; }
.check input { width: 1.25rem; height: 1.25rem; min-height: 0; margin-top: .15rem; flex: none; accent-color: var(--hibiscus); }
.consent { background: var(--leaf-soft); padding: .8rem; border-radius: var(--r-s); font-size: .92rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; flex-direction: row; align-items: center; gap: .4rem; padding: .6rem 1rem; border: 1.5px solid var(--mist); border-radius: 999px; background: #fff; font-weight: 600; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip input { position: absolute; opacity: 0; width: 1px; }
.chip:focus-within { outline: 3px solid var(--hibiscus); outline-offset: 2px; }
.chip-urgent { border-color: var(--hibiscus); color: var(--hibiscus); }
.code-input { font: 700 1.6rem/1 var(--mono); letter-spacing: .4em; text-align: center; }
.search { display: flex; gap: .5rem; margin: 1rem 0; } .search input { flex: 1; }
.filters { align-items: flex-end; margin-bottom: 1rem; } .filters label { min-width: 12rem; }

.pill { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill-good { background: var(--leaf-soft); color: var(--leaf); } .pill-warn { background: var(--amber-soft); color: var(--amber); }
.pill-bad { background: var(--red-soft); color: var(--hibiscus-deep); } .pill-neutral { background: #EEF2F1; color: var(--ink-soft); }
.badge { background: var(--hibiscus); color: #fff; border-radius: 999px; padding: 0 .4rem; font-size: .75rem; }

.alert { border-radius: var(--r-m); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.alert h2 { font-size: 1.1rem; }
.alert-info { background: var(--leaf-soft); border-left: 4px solid var(--leaf); }
.alert-danger { background: var(--red-soft); border-left: 4px solid var(--hibiscus); }
.alert-danger a { color: var(--hibiscus-deep); font-weight: 700; }

/* ---------- lists, cards, tables ---------- */
.cards { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.card { background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); padding: 1rem 1.1rem; display: grid; gap: .5rem; align-content: start; }
.card-attention { border-color: var(--hibiscus); box-shadow: inset 4px 0 0 var(--hibiscus); }
.list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; }
.list > li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .8rem .2rem; border-bottom: 1px solid var(--mist); }
.list > li > a { display: flex; flex: 1; justify-content: space-between; align-items: center; gap: .8rem; color: inherit; text-decoration: none; flex-wrap: wrap; }
.list > li > a > div, .list > li > div:first-child { display: grid; }
.list > li.done { opacity: .6; }
.list > li.row-alert { background: var(--red-soft); padding-inline: .6rem; border-radius: var(--r-s); }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); overflow: hidden; font-size: .92rem; }
.table th { text-align: left; font-size: .8rem; color: var(--ink-soft); font-weight: 600; background: #F8FBFA; }
.table th, .table td { padding: .65rem .7rem; border-bottom: 1px solid var(--mist); vertical-align: top; }
.table-dense td, .table-dense th { padding: .4rem .5rem; font-size: .82rem; }
.row-warn td { background: var(--amber-soft); } .row-alert td { background: var(--red-soft); }
@media (max-width: 700px) { .table { display: block; overflow-x: auto; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .8rem 1.2rem; margin: 0 0 1rem; }
.facts dt { font-size: .8rem; color: var(--ink-soft); } .facts dd { margin: 0; font-weight: 600; }
.total { font-size: 1.3rem; color: var(--hibiscus); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.stat { display: grid; gap: .1rem; padding: .9rem 1rem; background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); text-decoration: none; color: var(--ink); }
.stat strong { font: 720 1.7rem/1 var(--serif); } .stat span { font-size: .82rem; color: var(--ink-soft); }
.stat.on { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); } .stat-warn { border-color: var(--pollen); background: var(--amber-soft); }
.stats-big .stat strong { font-size: 2.3rem; color: var(--leaf); }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--mist); margin: 1rem 0; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--ink-soft); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a[aria-current] { color: var(--ink); border-color: var(--hibiscus); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: .3rem; padding: .25rem; background: #fff; border: 1px solid var(--mist); border-radius: 999px; margin-bottom: 1.2rem; }
.segmented a, .segmented button { padding: .5rem 1rem; border-radius: 999px; border: 0; background: none; font: 600 .92rem var(--sans); color: var(--ink); text-decoration: none; cursor: pointer; min-height: 2.5rem; }
.action-grid { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- journey components ---------- */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .8rem; margin-bottom: 1.8rem; }
.quick-card { display: grid; gap: .2rem; padding: 1.1rem; border-radius: var(--r-m); background: var(--ink); color: #fff; text-decoration: none; }
.quick-card strong { font: 700 1.15rem var(--serif); } .quick-card span { font-size: .88rem; opacity: .85; }
.quick-card:hover { background: var(--leaf); color: #fff; }
.quick-urgent { background: var(--hibiscus); } .quick-urgent:hover { background: var(--hibiscus-deep); }
.status-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .6rem 1rem; margin: 0; padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); }
.status-card dt { font-size: .78rem; color: var(--ink-soft); } .status-card dd { margin: 0; font-weight: 600; }
.status-card .status-state { font: 700 1.1rem var(--serif); color: var(--leaf); }
.status-card.compact { padding: .2rem 0; border: 0; }
.milestones { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.milestones li { display: flex; align-items: center; gap: .7rem; padding: .35rem 0; position: relative; color: var(--ink-soft); }
.milestones li::before { content: ""; position: absolute; left: .45rem; top: 1.4rem; bottom: -.5rem; width: 2px; background: var(--mist); }
.milestones li:last-child::before { display: none; }
.ms-dot { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--mist); background: #fff; flex: none; z-index: 1; }
.ms-done { color: var(--ink); } .ms-done .ms-dot { background: var(--leaf); border-color: var(--leaf); }
.ms-current { color: var(--ink); font-weight: 700; } .ms-current .ms-dot { border-color: var(--hibiscus); box-shadow: 0 0 0 4px var(--red-soft); }
.continuity { background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); padding: 1rem; }
.continuity header { display: flex; justify-content: space-between; align-items: center; }
.continuity ul { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .25rem; font-size: .92rem; }
.continuity .gap { color: var(--ink-soft); } .continuity-at_risk { border-color: var(--pollen); }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.timeline li { padding-left: 1rem; border-left: 2px solid var(--mist); }
.timeline time { display: block; font-size: .78rem; color: var(--ink-soft); }
.thread { background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); padding: 1rem; }
.thread ul { list-style: none; padding: 0; margin: 0 0 .8rem; display: grid; gap: .6rem; max-height: 22rem; overflow-y: auto; }
.thread li { background: var(--paper); border-radius: var(--r-m); padding: .55rem .75rem; max-width: 90%; }
.thread li.mine { background: var(--leaf-soft); justify-self: end; } .thread li.team-only { border: 1px dashed var(--pollen); }
.thread .who { font-size: .78rem; font-weight: 700; } .thread time { font-size: .72rem; color: var(--ink-soft); } .thread p { margin: .1rem 0; }
.thread-form { display: grid; gap: .5rem; }
.note { background: var(--leaf-soft); border-radius: var(--r-m); padding: .8rem 1rem; margin-bottom: .6rem; }
blockquote { margin: 0 0 .5rem; padding: .6rem .9rem; border-left: 3px solid var(--leaf); background: var(--paper); border-radius: 0 var(--r-s) var(--r-s) 0; }
.handoff { border-top: 1px solid var(--mist); padding: .8rem 0; }
.handoff-steps { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }
.handoff-steps li { font-size: .78rem; color: var(--ink-soft); border-top: 3px solid var(--mist); padding-top: .3rem; display: grid; }
.handoff-steps li.done { border-color: var(--leaf); color: var(--ink); font-weight: 600; } .handoff-steps time { font-weight: 400; }
.ai-card { margin-top: .8rem; padding: .9rem; border: 1px dashed var(--leaf); border-radius: var(--r-m); background: var(--leaf-soft); }
.ai-label { font-size: .78rem; font-weight: 700; color: var(--leaf); }
.feed { list-style: none; padding: 0; display: grid; gap: .6rem; } .feed li { background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); padding: .8rem 1rem; }
.feed li.unread { border-left: 4px solid var(--hibiscus); }
.rating { display: flex; gap: .4rem; } .rating label { display: block; }
.rating input { position: absolute; opacity: 0; } .rating span { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 1.5px solid var(--mist); border-radius: 50%; cursor: pointer; font-weight: 700; }
.rating input:checked + span { background: var(--hibiscus); color: #fff; border-color: var(--hibiscus); } .rating input:focus-visible + span { outline: 3px solid var(--hibiscus); }

/* ---------- doctors and booking ---------- */
.doctor-list { list-style: none; padding: 0; display: grid; gap: .8rem; }
.doctor { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); padding: 1rem; }
.doctor h2 { margin: 0; font-size: 1.15rem; } .doctor p { margin: .1rem 0; }
.doctor-avatar { width: 3.2rem; height: 3.2rem; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; font: 700 1.1rem var(--serif); }
@media (max-width: 560px) { .doctor { grid-template-columns: auto 1fr; } .doctor .btn { grid-column: 1 / -1; } }
.slot-days { display: grid; gap: 1rem; } .slot-day h3 { font-size: .95rem; font-family: var(--sans); font-weight: 700; }
.slots { display: flex; flex-wrap: wrap; gap: .4rem; }
.slot { min-height: 2.6rem; padding: .4rem .8rem; border-radius: var(--r-s); border: 1.5px solid var(--mist); background: #fff; font: 600 .95rem var(--sans); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.slot:hover { border-color: var(--leaf); } .slot.on { background: var(--hibiscus); border-color: var(--hibiscus); color: #fff; }

/* ---------- shop ---------- */
.product-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: .8rem; }
.product { background: #fff; border: 1px solid var(--mist); border-radius: var(--r-m); padding: 1rem; display: grid; gap: .3rem; align-content: start; }
.product h3 { font-size: 1rem; margin: 0; } .price { font: 700 1.15rem var(--serif); color: var(--leaf); margin: 0; }
.qty { display: flex; align-items: center; gap: .4rem; } .qty span { min-width: 1.5rem; text-align: center; font-weight: 700; }
.code-box { background: var(--ink); color: #fff; border-radius: var(--r-m); padding: 1rem 1.2rem; text-align: center; }
.code-box .code { display: block; font: 700 2rem/1.2 var(--mono); letter-spacing: .1em; margin: .3rem 0; color: var(--pollen); }
.code { font: 700 1.4rem var(--mono); }
.secret { font: 700 1rem var(--mono); background: var(--leaf-soft); padding: .2rem .4rem; border-radius: var(--r-s); word-break: break-all; }
.codes { columns: 2; list-style: none; padding: 0; font-size: 1.05rem; } .codes li { margin-bottom: .4rem; }
.steps-list li, .tick-list li { margin-bottom: .5rem; }

/* ---------- map ---------- */
.map-box { height: 320px; border-radius: var(--r-m); overflow: hidden; border: 1px solid var(--mist); }
.map-tall { height: min(62vh, 560px); }
.map { position: relative; overflow: hidden; touch-action: none; user-select: none; cursor: grab;
  background-color: #E8EFEC; background-image: linear-gradient(#DCE6E2 1px, transparent 1px), linear-gradient(90deg, #DCE6E2 1px, transparent 1px); background-size: 48px 48px; }
.map-tiles, .map-markers { position: absolute; inset: 0; }
.map-tiles img { position: absolute; left: 0; top: 0; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.line-trail { fill: none; stroke: var(--hibiscus); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.line-route { fill: none; stroke: var(--leaf); stroke-width: 3; stroke-dasharray: 6 6; }
.map-marker { position: absolute; left: 0; top: 0; transition: transform 2.2s linear; will-change: transform; }
.instant .map-marker, .map-marker.dragging { transition: none; }
.marker-dot { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; border: 3px solid #fff; box-shadow: var(--shadow); }
.marker-dot svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.marker-rider .marker-dot { background: var(--hibiscus); } .marker-ambulance .marker-dot { background: #C8102E; }
.marker-home .marker-dot { background: var(--leaf); } .marker-store .marker-dot, .marker-hospital .marker-dot { background: var(--ink); }
.marker-me .marker-dot { width: 18px; height: 18px; left: -9px; top: -9px; background: #2B6CDF; }
.marker-pin .marker-dot { background: var(--hibiscus); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); top: -38px; }
.marker-pin .marker-dot svg { transform: rotate(45deg); }
.map-marker.draggable { cursor: grab; } .map-marker.draggable:focus-visible .marker-dot { outline: 3px solid var(--pollen); }
.marker-label { position: absolute; left: 22px; top: -12px; white-space: nowrap; background: #fff; border-radius: var(--r-s); padding: .1rem .45rem; font-size: .75rem; font-weight: 700; box-shadow: var(--shadow); }
.no-label .marker-label { display: none; }
.map-zoom { position: absolute; right: .6rem; top: .6rem; display: grid; gap: .3rem; }
.map-zoom button { width: 2.4rem; height: 2.4rem; border-radius: var(--r-s); border: 1px solid var(--mist); background: #fff; font: 700 1.2rem var(--sans); cursor: pointer; }
.map-attrib { position: absolute; right: 0; bottom: 0; background: rgba(255,255,255,.85); font-size: .68rem; padding: .1rem .35rem; }

/* ---------- video ---------- */
.video-preview video { width: 100%; aspect-ratio: 4 / 3; background: var(--ink); border-radius: var(--r-m); object-fit: cover; transform: scaleX(-1); }
.call { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: 1fr auto; gap: .8rem; height: calc(100vh - 8rem); min-height: 520px; position: relative; }
.call-stage { grid-column: 1; grid-row: 1; background: #0B1F1A; border-radius: var(--r-l); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: .5rem; padding: .5rem; overflow: hidden; position: relative; }
.call-waiting { color: #fff; display: grid; place-content: center; text-align: center; padding: 2rem; }
.call-waiting h2 { color: #fff; }
.tile video { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-m); background: #000; }
.call-self { position: absolute; right: calc(300px + 1.6rem); bottom: 5.4rem; width: 160px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-m); border: 2px solid #fff; background: #000; transform: scaleX(-1); z-index: 2; }
.call-bar { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.call-side { grid-column: 2; grid-row: 1; display: grid; gap: 1rem; align-content: start; overflow-y: auto; }
.call-chat ul { list-style: none; padding: 0; display: grid; gap: .4rem; max-height: 40vh; overflow-y: auto; font-size: .9rem; }
.call-chat li.mine { color: var(--leaf); }
.call-banner { position: absolute; left: 1rem; top: 1rem; z-index: 3; padding: .6rem 1rem; border-radius: var(--r-m); font-weight: 700; max-width: calc(100% - 2rem - 300px); }
.call-banner-danger { background: var(--hibiscus); color: #fff; } .call-banner-warn { background: var(--pollen); } .call-banner-info { background: #fff; }
@media (max-width: 900px) {
  .call { grid-template-columns: 1fr; grid-template-rows: minmax(55vh, 1fr) auto auto; height: auto; }
  .call-side { grid-column: 1; grid-row: 3; } .call-self { right: 1rem; bottom: auto; top: 1rem; width: 96px; } .call-banner { max-width: calc(100% - 2rem); }
}

/* ---------- auth, dialogs, toasts ---------- */
.auth { min-height: 70vh; display: grid; place-content: center; padding: 1rem; }
.auth-card { width: min(28rem, 92vw); background: #fff; border: 1px solid var(--mist); border-radius: var(--r-l); padding: 1.8rem; box-shadow: var(--shadow); display: grid; gap: 1rem; }
.auth-note { text-align: center; color: var(--ink-soft); font-size: .88rem; margin-top: 1rem; }
.modal { border: 0; border-radius: var(--r-l); padding: 0; width: min(34rem, 94vw); max-height: 90vh; box-shadow: 0 30px 80px -30px rgba(0,0,0,.5); color: var(--ink); }
.modal::backdrop { background: rgba(14, 43, 37, .55); }
.modal-body { padding: 1.6rem; overflow-y: auto; max-height: 90vh; }
.modal-x { position: absolute; right: .6rem; top: .6rem; width: 2.4rem; height: 2.4rem; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--ink-soft); }
.safety-stop { display: grid; gap: .8rem; } .safety-stop h2 { color: var(--hibiscus-deep); }
.toasts { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); display: grid; gap: .5rem; z-index: 100; width: min(30rem, 92vw); }
.toast { background: var(--ink); color: #fff; padding: .8rem 1rem; border-radius: var(--r-m); box-shadow: var(--shadow); font-weight: 600; transition: opacity .4s, transform .4s; }
.toast-error { background: var(--hibiscus-deep); } .toast-warn { background: var(--pollen); color: var(--ink); }
.toast.leaving { opacity: 0; transform: translateY(8px); }
@media (prefers-reduced-motion: reduce) { .map-marker, .toast, .outlet[aria-busy] { transition: none; } }
