/* =====================================================================
   Carely design system
   Same teal identity as before, rebuilt as one consistent system:
   tokens -> base -> layout -> components -> pages. Light and dark.
   ===================================================================== */

:root {
  color-scheme: light;

  /* brand */
  --brand: #12958a;
  --brand-600: #0f7f76;
  --brand-700: #0b625b;
  --brand-300: #5fc9bd;
  --brand-100: #c9ece8;
  --brand-50: #e8f6f4;
  --on-brand: #ffffff;

  /* status */
  --danger: #d92d20;
  --danger-600: #b42318;
  --danger-50: #fef0ee;
  --warn: #dc6803;
  --warn-50: #fff4e5;
  --ok: #0e9f6e;
  --ok-50: #e6f7ef;
  --info: #2563eb;
  --info-50: #e8f0fe;
  --star: #f5a623;

  /* surfaces and text */
  --bg: #f4faf9;
  --surface: #ffffff;
  --surface-2: #eef6f5;
  --surface-3: #e3efed;
  --text: #0d2b28;
  --text-2: #496562;
  --text-3: #7b9490;
  --line: #dbe9e7;
  --overlay: rgba(8, 28, 26, 0.5);

  /* shape and depth */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-1: 0 1px 3px rgba(13, 43, 40, .09);
  --shadow-2: 0 4px 14px rgba(13, 43, 40, .14);

  /* type */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Poppins', 'Inter', system-ui, sans-serif;

  /* safe areas (Capacitor injects --safe-area-inset-*; env() works on newer WebViews) */
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sal: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --sar: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));

  --tabbar-h: 66px;
  --topbar-h: 60px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #2db8aa;
  --brand-600: #3cc7b9;
  --brand-700: #7fdcd2;
  --brand-300: #1d7d74;
  --brand-100: #14403c;
  --brand-50: #0f2f2c;
  --danger: #f2574a;
  --danger-600: #ff8a80;
  --danger-50: #3a1714;
  --warn: #f79009;
  --warn-50: #3a2608;
  --ok: #32d583;
  --ok-50: #0d3322;
  --info: #7aa7ff;
  --info-50: #14264d;
  --bg: #071615;
  --surface: #0e2321;
  --surface-2: #12302d;
  --surface-3: #18403c;
  --text: #e8f5f3;
  --text-2: #a9c7c3;
  --text-3: #7d9d99;
  --line: #1d3f3b;
  --overlay: rgba(0, 0, 0, 0.62);
  --shadow-1: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .5);
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; line-height: 1.25; color: var(--text); }
p { margin: 0; }
a { color: var(--brand-600); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; border-radius: 8px; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.clamp-1, .clamp-2 { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px;
  background: var(--brand); color: var(--on-brand); border-radius: var(--r-sm);
}
.skip-link:focus { top: calc(var(--sat) + 8px); }

/* page transition */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* reduced motion (Windows "Animation effects" off): calm everything except the logo, which only breathes gently */
@media (prefers-reduced-motion: reduce) { *:not(.orb):not(.orb *):not(.brand img) { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------------------------------------------------------------- layout */
.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px calc(16px + var(--sar)) calc(var(--tabbar-h) + var(--sab) + 28px) calc(16px + var(--sal));
}
.page.has-actionbar { padding-bottom: calc(var(--tabbar-h) + var(--sab) + 96px); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  padding-top: var(--sat);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-in {
  max-width: 1120px; margin: 0 auto; min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 8px calc(16px + var(--sar)) 8px calc(16px + var(--sal));
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 19px; color: var(--text); }
.brand img { width: 36px; height: 36px; object-fit: contain; animation: brand-breathe 3.8s ease-in-out infinite; will-change: transform; }
@keyframes brand-breathe { 0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); } 50% { transform: scale(1.12); filter: drop-shadow(0 0 7px color-mix(in srgb, var(--brand) 55%, transparent)); } }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topnav { display: none; }

.iconbtn {
  width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text); font-size: 18px;
  box-shadow: var(--shadow-1); position: relative; transition: transform .12s ease, background .2s;
}
.iconbtn:active { transform: scale(.93); }
.iconbtn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-family: var(--font);
}

.backbar-title { font-family: var(--font-head); font-weight: 600; font-size: 18px; }

/* bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: var(--sab);
}
.tabbar-in {
  max-width: 560px; margin: 0 auto; height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3); font-size: 11px; font-weight: 600; padding: 6px 2px;
  transition: color .15s;
}
.tab i { font-size: 21px; line-height: 1; }
.tab.active { color: var(--brand-600); }
.tab-sos span.sos-orb {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #f04438, #c01f13); color: #fff; font-size: 23px;
  box-shadow: 0 8px 20px rgba(217, 45, 32, .42), 0 0 0 5px var(--bg);
}
.tab-sos { color: var(--danger); }
.tab-sos.active { color: var(--danger); }

/* ---------------------------------------------------------------- components */

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border: 0; border-radius: var(--r-md);
  font-weight: 600; font-size: 14.5px; text-align: center; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  transition: transform .12s ease, filter .15s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-outline { background: transparent; color: var(--brand-700); box-shadow: inset 0 0 0 1.5px var(--brand-300); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger-soft { background: var(--danger-50); color: var(--danger-600); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

/* cards */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: 16px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 18px; font-weight: 600; }
.section-head .link { font-size: 13px; font-weight: 600; }

/* chips and badges */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 99px; background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 600; border: 1px solid var(--line);
  transition: background .15s, color .15s, border-color .15s;
}
.chip i { font-size: 13px; }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.chip.danger { color: var(--danger-600); background: var(--danger-50); border-color: transparent; }
.chip.danger.on { background: var(--danger); color: #fff; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: .1px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge i { font-size: 11px; }
.badge-er { background: var(--danger-50); color: var(--danger-600); }
.badge-ok { background: var(--ok-50); color: var(--ok); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-brand { background: var(--brand-50); color: var(--brand-700); }
.badge-warn { background: var(--warn-50); color: var(--warn); }

/* stars */
.stars { display: inline-flex; gap: 1px; color: var(--star); font-size: 13px; }
.stars .star-off { color: var(--line); }
.rating-pill { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; color: var(--text); }
.rating-pill i { color: var(--star); font-size: 12px; }

/* search */
.searchbar { display: flex; gap: 10px; align-items: center; }
.search-field {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 8px 0 16px;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); border: 1px solid transparent;
  transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within { border-color: var(--brand-300); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.search-field > i { color: var(--text-3); font-size: 16px; }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; font-size: 15px; height: 48px; }
.search-field input::placeholder { color: var(--text-3); }
.search-field .mic, .search-field .go { border: 0; background: transparent; color: var(--brand-700); width: 38px; height: 38px; border-radius: 50%; font-size: 17px; }
.search-field .go { background: var(--brand); color: #fff; }

/* hero / banners */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 22px 20px;
  background: linear-gradient(135deg, #0b6e66 0%, #12958a 55%, #3bbdaf 100%); color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 25%, transparent);
}
.hero::after {
  content: ''; position: absolute; right: -50px; top: -50px; width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%);
}
.hero h1, .hero h2 { color: #fff; font-size: 22px; font-weight: 600; max-width: 14em; }
.hero p { opacity: .92; margin-top: 6px; font-size: 14px; max-width: 26em; }
.hero .btn { margin-top: 16px; position: relative; z-index: 1; background: #fff; color: var(--brand-700); }
.hero-img { position: absolute; right: 6px; bottom: 0; height: 100%; max-height: 190px; width: auto; z-index: 0; }
.hero-body { position: relative; z-index: 1; max-width: 64%; }

.sos-strip {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, #c01f13, #f04438); color: #fff; box-shadow: 0 10px 26px rgba(217, 45, 32, .28);
}
.sos-strip .ic { width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none; }
.sos-strip b { display: block; font-family: var(--font-head); font-size: 14.5px; font-weight: 600; }
.sos-strip small { opacity: .92; font-size: 12px; }
.sos-strip .btn { margin-left: auto; background: #fff; color: var(--danger-600); min-height: 40px; padding: 0 14px; }

/* quick actions */
.qgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qitem {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  color: var(--text); font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2;
  transition: transform .12s ease;
}
.qitem:active { transform: scale(.96); }
.qicon { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.qc-teal { background: var(--brand-50); color: var(--brand-600); }
.qc-blue { background: var(--info-50); color: var(--info); }
.qc-red { background: var(--danger-50); color: var(--danger); }
.qc-amber { background: var(--warn-50); color: var(--warn); }
.qc-green { background: var(--ok-50); color: var(--ok); }
.qc-purple { background: rgba(124, 92, 255, .14); color: #7c5cff; }

/* hospital card */
.hlist { display: grid; gap: 12px; }
.hcard { position: relative; padding: 14px; display: grid; gap: 12px; }
.hcard-top { display: grid; grid-template-columns: 68px 1fr auto; gap: 12px; align-items: start; }
.thumb {
  width: 68px; height: 68px; border-radius: 16px; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 22px; color: #fff; letter-spacing: .5px;
  background: linear-gradient(140deg, var(--tA), var(--tB));
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.t0 { --tA: #0f8a80; --tB: #4cc3b6; }
.t1 { --tA: #2563eb; --tB: #6ea0ff; }
.t2 { --tA: #6d4be0; --tB: #a28bff; }
.t3 { --tA: #0e9f6e; --tB: #54d3a0; }
.t4 { --tA: #d9730d; --tB: #f7b155; }
.t5 { --tA: #db4f78; --tB: #f59ab5; }
.hname { font-size: 15.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.hname a { color: inherit; }
.hname a::after { content: ''; position: absolute; inset: 0; border-radius: var(--r-lg); z-index: 1; }
.haddr { margin-top: 2px; font-size: 13px; color: var(--text-2); }
.hmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.hmeta .dist { font-size: 12.5px; font-weight: 600; color: var(--brand-700); display: inline-flex; align-items: center; gap: 4px; }
.save-btn {
  position: relative; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2); font-size: 17px; display: flex; align-items: center; justify-content: center;
  transition: transform .12s, color .15s, background .15s;
}
.save-btn:active { transform: scale(.88); }
.save-btn.on { color: var(--danger); background: var(--danger-50); }
.hactions { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.hactions .btn { flex: 1; }
.cmp-toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  padding: 0 4px 0 6px; min-height: 38px; cursor: pointer; user-select: none;
}
.cmp-toggle input { width: 18px; height: 18px; accent-color: var(--brand); }

/* load more / pager */
.loadmore { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0 4px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 20px 0 4px; font-size: 13px; color: var(--text-2); }

/* skeleton */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel {
  border-radius: 12px; min-height: 14px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
}
.skel-card { padding: 14px; display: grid; grid-template-columns: 68px 1fr; gap: 12px; }
.skel-card .skel:first-child { width: 68px; height: 68px; border-radius: 16px; }

/* empty state */
.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty .ic { width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font-size: 15px; outline: 0; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 92px; padding: 12px 14px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-md); }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 11px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span { outline: 3px solid var(--brand-300); }

/* bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(18px + var(--sab));
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  max-width: 560px; margin: 0 auto; box-shadow: var(--shadow-2);
}
.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet-open .sheet { transform: none; }
.sheet-handle { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 14px; }
.sheet h2 { font-size: 18px; margin-bottom: 14px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 8px; position: sticky; bottom: 0; background: var(--surface); padding-top: 8px; }

/* tabs */
.tabs { display: flex; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: var(--r-md); }
.tabs button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 11px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-1); }
.tabpanel { margin-top: 16px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px 8px; text-align: center; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.stat i { color: var(--brand); font-size: 18px; }
.stat b { display: block; margin-top: 4px; font-size: 15px; font-family: var(--font-head); font-weight: 600; }
.stat span { font-size: 11.5px; color: var(--text-2); }

/* detail hero */
.dhero {
  position: relative; height: 190px; border-radius: var(--r-xl); overflow: hidden; margin-bottom: 16px;
  background: linear-gradient(140deg, var(--tA), var(--tB)); display: flex; align-items: center; justify-content: center;
}
.dhero img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dhero .mono { font-family: var(--font-head); font-size: 56px; font-weight: 700; color: rgba(255, 255, 255, .92); letter-spacing: 2px; text-shadow: 0 4px 24px rgba(0, 0, 0, .18); }
.dhero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, .28)); }
.dhero .badges { position: absolute; left: 14px; bottom: 12px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.dhead h1 { font-size: 22px; font-weight: 600; }
.dhead .sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.dhead .ratingline { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* sticky action bar */
.actionbar {
  position: fixed; left: 0; right: 0; z-index: 35; bottom: calc(var(--tabbar-h) + var(--sab));
  padding: 10px calc(16px + var(--sar)) 10px calc(16px + var(--sal));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.actionbar-in { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.actionbar .btn { flex: 1; }

/* generic rows (info / settings) */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); border-bottom: 1px solid var(--line); background: transparent; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; }
.row:last-child { border-bottom: 0; }
.row .ric { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; font-size: 17px; }
.row .rtext { flex: 1; min-width: 0; }
.row .rtext b { display: block; font-size: 14.5px; font-weight: 600; }
.row .rtext small { color: var(--text-2); font-size: 12.5px; }
.row > .bi-chevron-right { color: var(--text-3); }
a.row:active, button.row:active { background: var(--surface-2); }
.infolines { display: grid; gap: 10px; }
.infoline { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); }
.infoline i { color: var(--brand); margin-top: 3px; }
.infoline a { color: var(--brand-700); font-weight: 600; }

/* services and schemes */
.svc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.svc { padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.svc .ric { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; font-size: 17px; }
.svc b { font-size: 14px; display: block; }
.svc p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.scheme { padding: 16px; display: block; color: var(--text); }
.scheme h3 { font-size: 15.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.scheme h3 i { color: var(--brand); }
.scheme p { color: var(--text-2); font-size: 13.5px; margin-top: 6px; }
.scheme .foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

/* reviews */
.review { padding: 14px 16px; }
.review + .review { margin-top: 10px; }
.review header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-head); }
.rate-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.rate-input input { position: absolute; opacity: 0; }
.rate-input label { font-size: 30px; color: var(--line); cursor: pointer; line-height: 1; transition: color .1s, transform .1s; }
.rate-input label:hover, .rate-input label:hover ~ label, .rate-input input:checked ~ label { color: var(--star); }
.rate-input input:focus-visible + label { outline: 3px solid var(--brand-300); border-radius: 6px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* rating summary */
.rsum { display: flex; align-items: center; gap: 16px; padding: 16px; }
.rsum .big { font-family: var(--font-head); font-size: 36px; font-weight: 700; line-height: 1; }

/* emergency */
.er-hero { border-radius: var(--r-xl); padding: 22px 20px; color: #fff; background: linear-gradient(135deg, #a31b11, #f04438); box-shadow: 0 6px 16px rgba(217, 45, 32, .25); }
.er-hero h1 { color: #fff; font-size: 24px; font-weight: 700; }
.er-hero p { opacity: .94; margin: 6px 0 16px; font-size: 14px; }
.callbig { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; border-radius: var(--r-lg); background: #fff; color: var(--danger-600); font-family: var(--font-head); font-weight: 700; font-size: 20px; }
.num-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.num-card { display: flex; align-items: center; gap: 12px; padding: 12px; color: var(--text); }
.num-card .ic { width: 40px; height: 40px; border-radius: 50%; background: var(--danger-50); color: var(--danger); display: flex; align-items: center; justify-content: center; flex: none; }
.num-card b { font-size: 17px; font-family: var(--font-head); display: block; line-height: 1.1; }
.num-card small { font-size: 11.5px; color: var(--text-2); line-height: 1.2; display: block; }
.aid { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); margin-bottom: 10px; overflow: hidden; }
.aid summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 600; font-size: 14.5px; cursor: pointer; }
.aid summary::-webkit-details-marker { display: none; }
.aid summary .lead { color: var(--danger); font-size: 18px; }
.aid summary .chev { margin-left: auto; color: var(--text-3); transition: transform .2s; }
.aid[open] summary .chev { transform: rotate(180deg); }
.aid ol { margin: 0; padding: 0 18px 16px 40px; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.sos-btn {
  width: 168px; height: 168px; border-radius: 50%; border: 0; margin: 4px auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(circle at 30% 25%, #ff7a6e, #d92d20 60%, #a31b11); color: #fff;
  font-family: var(--font-head); font-weight: 700; font-size: 34px; letter-spacing: 1px;
  box-shadow: 0 0 0 10px rgba(217, 45, 32, .12), 0 0 0 22px rgba(217, 45, 32, .06), 0 16px 40px rgba(217, 45, 32, .4);
}
.sos-btn small { font-size: 11px; font-weight: 500; opacity: .9; letter-spacing: 0; font-family: var(--font); }
.sos-btn:active { transform: scale(.96); }
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(163, 27, 17, .96); color: #fff; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 24px; }
.overlay.open { display: flex; }
.overlay .count { font-family: var(--font-head); font-size: 110px; font-weight: 700; line-height: 1; }
.overlay .btn { background: #fff; color: var(--danger-600); min-width: 180px; }

/* medicines */
.mgrid { display: grid; gap: 10px; }
.mcard { display: flex; align-items: center; gap: 14px; padding: 14px; color: var(--text); }
.mcard .mic { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-50); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.mcard .mtext { flex: 1; min-width: 0; }
.mcard b { font-size: 14.5px; font-weight: 600; line-height: 1.3; display: block; }
.mcard small { color: var(--text-2); font-size: 12.5px; }
.price { font-family: var(--font-head); font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.price small { display: block; font-family: var(--font); font-weight: 500; text-align: right; color: var(--text-3); font-size: 11px; }
.price-hero { font-family: var(--font-head); font-size: 34px; font-weight: 700; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--warn-50); color: var(--text); font-size: 13px; line-height: 1.45; }
.notice i { color: var(--warn); margin-top: 2px; }
.notice.info { background: var(--info-50); } .notice.info i { color: var(--info); }

/* compare */
.cmp-bar {
  position: fixed; left: 50%; transform: translate(-50%, 140%); z-index: 38; transition: transform .25s;
  bottom: calc(var(--tabbar-h) + var(--sab) + 12px);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 99px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-2); font-size: 13.5px; font-weight: 600; width: max-content; max-width: calc(100vw - 24px);
}
.cmp-bar.show { transform: translate(-50%, 0); }
.cmp-bar .btn { min-height: 38px; background: var(--brand); color: #fff; }
.cmp-bar .x { border: 0; background: transparent; color: inherit; opacity: .7; width: 32px; height: 32px; font-size: 16px; }
.cmp-wrap { overflow-x: auto; }
table.cmp { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 560px; }
table.cmp th, table.cmp td { padding: 12px; text-align: center; font-size: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.cmp thead th { position: sticky; top: 0; background: var(--surface); }
table.cmp th.rowh, table.cmp td.rowh { text-align: left; color: var(--text-2); font-weight: 600; font-size: 13px; position: sticky; left: 0; background: var(--surface); }
table.cmp td.best { color: var(--ok); font-weight: 700; background: var(--ok-50); }
table.cmp .mini { display: grid; gap: 8px; justify-items: center; }
table.cmp .mini .thumb { width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }
table.cmp .mini a { font-weight: 600; font-size: 13.5px; color: var(--text); }
.tick { color: var(--ok); } .cross { color: var(--text-3); }

/* map */
.map-shell { position: relative; border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-1); height: calc(100dvh - var(--topbar-h) - var(--sat) - var(--tabbar-h) - var(--sab) - 56px); min-height: 360px; background: var(--surface-2); }
#map { position: absolute; inset: 0; z-index: 1; }
.map-overlay-top { position: absolute; z-index: 5; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; }
.map-overlay-top .chips { flex: 1; }
.map-card { position: absolute; z-index: 6; left: 12px; right: 12px; bottom: 12px; padding: 14px; display: none; }
.map-card.open { display: block; animation: fade-up .22s ease-out; }
.pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--brand); border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); display: flex; align-items: center; justify-content: center; }
.pin i { transform: rotate(45deg); color: #fff; font-size: 14px; }
.pin.er { background: var(--danger); }
.pin.sel { transform: rotate(-45deg) scale(1.25); z-index: 1000 !important; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(37, 99, 235, .22); }
.leaflet-container { font-family: var(--font); }

/* symptom guide */
.sym-group { margin-bottom: 18px; }
.sym-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin-bottom: 8px; font-family: var(--font); font-weight: 700; }
.sym-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sym { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 500; text-align: left; transition: all .15s; }
.sym.on { background: var(--brand-50); border-color: var(--brand); color: var(--brand-700); font-weight: 600; }
.sym.danger.on { background: var(--danger-50); border-color: var(--danger); color: var(--danger-600); }
.result { border-radius: var(--r-xl); padding: 20px; color: var(--text); }
.result h2 { font-size: 20px; }
.result.emergency { background: var(--danger-50); box-shadow: inset 0 0 0 2px var(--danger); }
.result.urgent { background: var(--warn-50); box-shadow: inset 0 0 0 2px var(--warn); }
.result.routine { background: var(--ok-50); box-shadow: inset 0 0 0 2px var(--ok); }

/* medical id */
.idcard { border-radius: var(--r-xl); padding: 20px; color: #fff; background: linear-gradient(135deg, #0b6e66, #12958a 60%, #3bbdaf); box-shadow: 0 16px 36px color-mix(in srgb, var(--brand) 28%, transparent); }
.idcard .row2 { display: flex; justify-content: space-between; gap: 12px; }
.idcard .blood { font-family: var(--font-head); font-weight: 700; font-size: 38px; line-height: 1; background: rgba(255, 255, 255, .18); border-radius: 16px; padding: 10px 14px; }
.idcard dl { display: grid; gap: 10px; margin: 16px 0 0; }
.idcard dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; opacity: .8; }
.idcard dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.idcard a { color: #fff; text-decoration: underline; }

/* tracker */
.progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-300)); border-radius: 99px; transition: width .35s; }
.dose { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dose:last-child { border-bottom: 0; }
.dose input { width: 22px; height: 22px; accent-color: var(--brand); }
.dose.done .dname { text-decoration: line-through; color: var(--text-3); }
.dose .dname { flex: 1; font-weight: 600; font-size: 14.5px; }

/* toast */
.toast-region { position: fixed; left: 0; right: 0; z-index: 120; bottom: calc(var(--tabbar-h) + var(--sab) + 18px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 99px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-2); animation: fade-up .22s ease-out both; max-width: 92vw; }

/* pull to refresh */
.ptr { opacity: 0; position: fixed; left: 50%; top: calc(var(--sat) + 64px); z-index: 50; transform: translate(-50%, -70px); width: 40px; height: 40px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-2); display: flex; align-items: center; justify-content: center; color: var(--brand); transition: transform .15s; }
.ptr.spin i { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================ welcome page (index.html) */
.landing { min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden;
  padding: calc(var(--sat) + 18px) clamp(20px, 4.5vw, 96px) calc(var(--sab) + 26px);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--brand) 16%, transparent), transparent 36%),
    radial-gradient(circle at bottom right, color-mix(in srgb, var(--star) 18%, transparent), transparent 30%), var(--bg); }
.landing-in { width: 100%; max-width: 1500px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }

.land-nav { display: flex; align-items: center; gap: 12px; min-height: 68px; }
.land-nav .brand { font-size: clamp(1.4rem, 1.6vw, 1.8rem); }
.land-nav .brand img { width: 46px; height: 46px; border-radius: 14px; background: var(--surface); padding: 6px; box-shadow: var(--shadow-1); animation: logo-in 1.1s cubic-bezier(.2, .8, .2, 1) .2s both, brand-breathe 3.8s ease-in-out 1.4s infinite; }
.land-nav .topnav { margin-left: 28px; }
.land-nav .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.anim-note { display: none; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 99px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.anim-note { white-space: nowrap; }
.anim-note.show { display: inline-flex; }
@media (max-width: 600px) { .anim-note > span { display: none; } .land-nav .brand span { font-size: 1.3rem; } }
.anim-note b { color: var(--brand-700); }

.land-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 10px 0 18px; text-align: center; }
.land-hero .art { order: -1; display: flex; justify-content: center; padding: 22px 0 6px; }
.land-hero .copy { display: flex; flex-direction: column; align-items: center; }
.eyebrow { display: inline-block; padding: 8px 16px; border-radius: 99px; background: var(--brand-50); color: var(--brand-700); font-size: 13.5px; font-weight: 600; margin-bottom: 16px; }
.landing h1 { font-size: clamp(2.3rem, 4vw, 4.4rem); font-weight: 700; line-height: 1.04; letter-spacing: -.02em; color: var(--text); }
.landing h1 em { font-style: normal; color: var(--brand); }
.landing .lead { margin-top: 20px; font-size: clamp(1rem, 1.05vw, 1.2rem); line-height: 1.65; color: var(--text-2); max-width: 34em; }
.landing .cta { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; justify-content: center; width: 100%; }
.landing .cta .btn { flex: 1 1 170px; max-width: 250px; min-height: 52px; font-size: 16px; justify-content: center; transition: transform .2s ease; }
.landing .cta .btn:hover, .quick-btns .btn:hover { transform: translateY(-2px); }
.quick-btns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; width: 100%; max-width: 640px; }
.quick-btns .btn { min-height: 50px; justify-content: center; transition: transform .2s ease; }

.land-feats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 8px; }
.land-feat { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 6px; text-align: left; box-shadow: var(--shadow-1); transition: transform .25s ease, box-shadow .25s ease; }
@media (hover: hover) { .land-feat:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); } }
.land-feat .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); font-size: 22px; margin-bottom: 6px; }
.land-feat b { font-size: 16px; }
.land-feat p { font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.landing-foot { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* the logo: a circle that breathes. Only transform and opacity are animated, so it is cheap to draw */
.orb { position: relative; width: clamp(220px, 58vw, 320px); aspect-ratio: 1; transition: transform .35s ease; }
.orb-glow { position: absolute; inset: -18%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 34%, transparent) 0%, transparent 66%);
  animation: glow 4.4s ease-in-out infinite; will-change: transform, opacity; }
.orb-img { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: #fafaf8;
  border: 6px solid #fff; outline: 2px solid color-mix(in srgb, var(--brand) 38%, transparent);
  box-shadow: 0 24px 60px rgba(10, 94, 87, .22), 0 0 0 14px color-mix(in srgb, var(--brand) 8%, transparent);
  animation: logo-in 1.2s cubic-bezier(.2, .8, .2, 1) .15s both, breathe 4.6s ease-in-out 1.4s infinite; will-change: transform; }
.orb-img img { width: 100%; height: 100%; display: block; object-fit: cover; }
.orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand); opacity: 0; animation: ring 4.6s ease-out 1.4s infinite; will-change: transform, opacity; }
.orb .ring.r2 { animation-delay: 3.7s; }
@media (hover: hover) { .orb:hover { transform: scale(1.04); } }
@keyframes logo-in { 0% { transform: scale(.6) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.08) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes glow { 0%, 100% { transform: scale(.88); opacity: .5; } 50% { transform: scale(1.14); opacity: 1; } }
@keyframes ring { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(1.45); opacity: 0; } }
/* staggered entrance, runs once */
.reveal { opacity: 0; transform: translateY(16px); animation: rise .8s cubic-bezier(.2, .7, .2, 1) forwards; animation-delay: calc(var(--i, 0) * 120ms + 80ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (min-width: 840px) {
  .land-hero { display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: clamp(32px, 4vw, 90px); text-align: left; }
  .land-hero .art { order: 0; padding: 0; }
  .land-hero .copy { align-items: flex-start; }
  .landing .cta { justify-content: flex-start; }
  .quick-btns { grid-template-columns: repeat(4, 1fr); }
  .orb { width: clamp(300px, min(34vw, 58vh), 580px); }
  .land-feats { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .land-feat { padding: 16px 18px; }
  .land-feat p { font-size: 13px; }
}
@media (min-width: 1500px) { .land-nav .topnav a { font-size: 15px; } }

/* leaflet attribution small */
.leaflet-control-attribution { font-size: 10px; }

/* ---------------------------------------------------------------- desktop */
@media (min-width: 760px) {
  .hlist { grid-template-columns: repeat(2, 1fr); }
  .mgrid { grid-template-columns: repeat(2, 1fr); }
  .svc-grid { grid-template-columns: repeat(3, 1fr); }
  .num-grid { grid-template-columns: repeat(3, 1fr); }
  .qgrid { grid-template-columns: repeat(8, 1fr); }
  .hero-body { max-width: 56%; }
  .hero { padding: 32px 36px; }
  .hero h1, .hero h2 { font-size: 30px; }
  .hero-img { max-height: 260px; right: 40px; }
}
@media (min-width: 900px) {
  :root { --tabbar-h: 0px; }
  .tabbar { display: none; }
  .page { padding-bottom: 48px; padding-top: 24px; }
  .page.has-actionbar { padding-bottom: 110px; }
  .topnav { display: flex; gap: 4px; margin-left: 24px; }
  .topnav a { padding: 9px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--text-2); }
  .topnav a.active, .topnav a:hover { background: var(--brand-50); color: var(--brand-700); }
  .topnav a.sos { color: var(--danger-600); }
  .topnav a.sos.active, .topnav a.sos:hover { background: var(--danger-50); }
  .actionbar { bottom: 0; }
  .cmp-bar, .toast-region { bottom: 24px; }
  .sheet { bottom: 50%; transform: translateY(60%) scale(.96); opacity: 0; pointer-events: none; border-radius: 26px; max-width: 520px; transition: transform .22s, opacity .2s; }
  .sheet-open .sheet { transform: translateY(50%); opacity: 1; pointer-events: auto; }
  .map-shell { height: calc(100dvh - 200px); }
  .backbar-title { font-size: 20px; }
}
@media (min-width: 1100px) {
  .hlist { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media print { .tabbar, .topbar, .actionbar, .toast-region { display: none !important; } }

/* button-style segmented control */
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 11px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.on, :root:not([data-theme="dark"]) .seg button[data-theme-switch="light"].on { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-1); }
.searchbar.stack { flex-direction: column; align-items: stretch; }
.searchbar.stack .search-field { flex: none; }
/* the compare bar must never cover a page's own bottom action bar */
body:has(.actionbar) .cmp-bar { display: none; }
body:has(.cmp-bar.show) .page { padding-bottom: calc(var(--tabbar-h) + var(--sab) + 110px); }

/* ---- power saving: long lists are only painted when near the screen */
.hcard, .mcard, .svc { content-visibility: auto; contain-intrinsic-size: auto 150px; }

/* find-hospitals prompt on Home */
.find-card { padding: 20px; display: grid; gap: 14px; text-align: center; justify-items: center; }
.find-card .qicon { width: 56px; height: 56px; font-size: 26px; }
.find-card h2 { font-size: 18px; }
.find-card .row-btns { display: grid; gap: 10px; width: 100%; max-width: 360px; }

/* ---- lite mode (Auto on weak devices / data saver / reduced motion, or switched on in More): no animation, no shadows */
html.lite *, html.lite *::before, html.lite *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.lite .reveal { opacity: 1; transform: none; }
html.lite .orb .ring, html.lite .orb-glow { display: none; }
html.lite .card, html.lite .hcard, html.lite .tabbar, html.lite .search-field, html.lite .sheet, 
html.lite .card, html.lite .hcard { border: 1px solid var(--line); }
html.lite .hero, html.lite .er-hero { background-image: none; }
html.lite .hero, html.lite .er-hero { background: var(--brand-700); }
html.lite .er-hero { background: var(--danger-600); }
html.lite .sos-btn { box-shadow: none; }
html.paused *, html.paused *::before, html.paused *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; }  }


/* map: clusters in the Carely colours */
.leaflet-container .marker-cluster-small, .leaflet-container .marker-cluster-medium, .leaflet-container .marker-cluster-large { background-color: color-mix(in srgb, var(--brand) 28%, transparent); }
.leaflet-container .marker-cluster-small div, .leaflet-container .marker-cluster-medium div, .leaflet-container .marker-cluster-large div { background-color: var(--brand); color: #fff; font-weight: 700; font-family: var(--font); }

/* ================================================================ wide (desktop) layouts */
.detail-grid { display: block; }
.d-aside { margin-top: 18px; }
.d-actions { display: none; }
@media (min-width: 1000px) {
  .topbar-in, .page { max-width: 1280px; }
  .page.narrow { max-width: 780px; }
  .hlist { grid-template-columns: repeat(2, 1fr); }
  .mgrid { grid-template-columns: repeat(3, 1fr); }
  .svc-grid { grid-template-columns: repeat(4, 1fr); }
  .searchbar.stack { flex-direction: row; }
  .searchbar.stack .select { width: 230px; flex: none; }

  /* hospital page: details on the left, sticky call panel on the right */
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "head aside" "tabs aside"; gap: 0 28px; align-items: start; }
  .detail-grid > .dhead { grid-area: head; }
  .detail-grid > .section { grid-area: tabs; }
  .d-aside { grid-area: aside; position: sticky; top: 88px; display: grid; gap: 14px; margin-top: 18px; }
  .d-aside .stats { margin-top: 0; }
  .d-actions { display: grid; gap: 10px; }
  body:has(.d-aside) .actionbar { display: none; }
  .page.has-actionbar:has(.d-aside) { padding-bottom: 48px; }

  /* emergency page: two columns under the red banner */
  .er-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start; }
  .er-grid > .er-hero, .er-grid > .overlay { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .hlist { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .mgrid { grid-template-columns: repeat(3, 1fr); }
  .svc-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 1000px) {
  .er-grid .hlist { grid-template-columns: 1fr; }
  .searchbar.stack .search-field { flex: 1; }
}

/* ================================================================ accounts (sign in, sign up, my account, two-step) */
.auth .page, .page.auth { padding-top: 8px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 26px 22px; box-shadow: var(--shadow-1); max-width: 460px; margin: 10px auto 24px; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 24px; font-weight: 700; margin: 4px 0 4px; }
.auth-card .muted { margin-bottom: 18px; font-size: 14px; }
.auth-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); font-size: 26px; margin-bottom: 8px; }
.auth-ic.good { background: #dcfce7; color: #15803d; }
.auth input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .auth select, .auth textarea, .auth-card input:not([type=checkbox]):not([type=radio]):not([type=hidden]) {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-size: 15px; outline: 0; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.auth input:focus, .auth select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.auth form > button[type=submit], .auth button[type=submit].btn { margin-top: 6px; }
.auth button:not(.btn):not(.row):not(.iconbtn):not([type=button]) { width: 100%; min-height: 50px; border: 0; border-radius: 99px; background: var(--brand); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; margin-top: 8px; }
.auth h1 { font-family: var(--font-head); }
.auth p { line-height: 1.55; }
.auth table { width: 100%; }
.ferr { color: var(--danger-600, #b42318); font-size: 13px; margin: 2px 0 0; }
.ferr.box { background: #fef3f2; border: 1px solid #fecdca; border-radius: 12px; padding: 10px 12px; margin: 0 0 14px; }
.fhelp { color: var(--text-3); font-size: 12.5px; margin: 2px 0 0; }
.auth-check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 4px 0 12px; }
.auth-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; margin: 18px 0 12px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-foot { text-align: center; font-size: 14px; color: var(--text-2); margin-top: 18px; }
.auth-foot a, .auth-card a:not(.btn) { color: var(--brand-700); font-weight: 600; }
.rolepick { border: 0; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rolecard { position: relative; margin: 0; cursor: pointer; }
.rolecard input { position: absolute; opacity: 0; pointer-events: none; }
.rolecard span { display: grid; gap: 2px; justify-items: start; padding: 12px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-height: 96px; align-content: start; transition: border-color .15s, background .15s; }
.rolecard i { font-size: 22px; color: var(--brand); }
.rolecard b { font-size: 14px; }
.rolecard small { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }
.rolecard input:checked + span { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.rolecard input:focus-visible + span { outline: 3px solid var(--brand-300); }
.me-head { display: flex; align-items: center; gap: 14px; }
.me-head h1 { margin: 0; }
.me-head .muted { margin: 0; }
.me-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 700; flex: none; }
.me-badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.badge-role, .badge-status { font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: var(--brand-50); color: var(--brand-700); text-decoration: none; }
.badge-status.s-approved { background: #dcfce7; color: #15803d; }
.badge-status.s-pending { background: #fef3c7; color: #b45309; }
.badge-status.s-rejected { background: #fee2e2; color: #b42318; }
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 16px; }
.notice.good { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.notice.bad { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.danger-zone { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 14px; }
.danger-zone summary { cursor: pointer; color: var(--danger-600, #b42318); font-weight: 600; }
.danger-zone input { margin: 8px 0; }
.steps { padding-left: 20px; display: grid; gap: 14px; font-size: 14.5px; line-height: 1.5; margin-bottom: 14px; }
.qr { width: 260px; max-width: 100%; margin: 12px auto 4px; background: #fff; padding: 8px; border-radius: 14px; border: 1px solid var(--line); }
.qr svg, .qr img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.linkbtn { all: unset; cursor: pointer; color: var(--brand); font-weight: 700; }
.secret, .codes code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; display: block; word-break: break-all; margin-top: 6px; font-size: 13.5px; }
.otp { text-align: center; font-size: 24px !important; letter-spacing: .3em; font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 18px; }
.codes code { text-align: center; font-size: 15px; margin: 0; }
.flash-wrap { display: grid; gap: 8px; margin: 0 0 14px; }
.flash { padding: 11px 14px; border-radius: 12px; font-size: 14px; background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--line); }
.flash.error { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.flash.warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.flash.success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
[data-theme=dark] .notice { background: #2b2412; color: #fcd34d; border-color: #5b4a17; }
[data-theme=dark] .ferr.box, [data-theme=dark] .notice.bad { background: #331816; color: #fda29b; border-color: #5c2420; }
[data-theme=dark] .notice.good { background: #12301f; color: #86efac; border-color: #1f5133; }
[data-theme=dark] .flash.error { background: #331816; color: #fda29b; border-color: #5c2420; }
.city-chip { max-width: 100%; }
.city-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
.fhelp ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 1px; }
.fhelp li { font-size: 12px; line-height: 1.4; }
.auth .field { margin-bottom: 12px; }

/* ---- v8: sign in / sign up buttons in every header, guest banner, gate, consent ---- */
.authbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 99px; font-weight: 700; font-size: 14px; white-space: nowrap; transition: transform .12s ease, background .2s; }
.authbtn:active { transform: scale(.96); }
.authbtn.ghost { color: var(--brand-700); background: transparent; box-shadow: inset 0 0 0 1.5px var(--brand-300); }
.authbtn.solid { color: var(--on-brand); background: var(--brand); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 32%, transparent); }
.authbtn.me { color: var(--text); background: var(--surface); box-shadow: var(--shadow-1); padding: 0 14px 0 10px; }
.authbtn.me i { font-size: 20px; color: var(--brand); }
@media (max-width: 480px) { .authbtn { min-height: 34px; padding: 0 12px; font-size: 13px; } .authbtn.me span { display: none; } .authbtn.me { padding: 0 8px; } .topbar-actions, .land-nav .actions { gap: 6px; } .topbar-in { gap: 6px; } }
@media (max-width: 420px) { .topbar-actions .iconbtn { width: 34px; height: 34px; } .topbar-actions { gap: 4px; } .authbtn { padding: 0 10px; } }
@media (max-width: 400px) { .topbar .brand span, .topbar .brand b, .topbar .brand-name { display: none; } }

.guest-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius, 16px); background: color-mix(in srgb, var(--brand) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.guest-banner > i { font-size: 22px; color: var(--brand); }
.guest-banner .gtxt { flex: 1 1 220px; font-size: 14px; color: var(--text-2); }
.guest-banner .gtxt b { color: var(--text); }
.guest-banner .gbtns { display: flex; gap: 8px; }

.gate { text-align: center; padding: 28px 20px; }
.gate .gate-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.gate ul { list-style: none; padding: 0; margin: 14px 0; text-align: left; display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.gate ul i { color: var(--brand); margin-right: 8px; }
.gate .gate-btns { display: grid; gap: 10px; margin-top: 12px; }
.gate .sos-link { margin-top: 14px; font-size: 13px; color: var(--text-2); }

.consent-bar { position: fixed; left: 12px; right: 12px; bottom: calc(86px + var(--sab, 0px)); z-index: 60; max-width: 640px; margin: 0 auto; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2, 0 12px 30px rgba(0,0,0,.2)); font-size: 13.5px; color: var(--text-2); }
.consent-bar b { color: var(--text); }
.consent-bar form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
@media (min-width: 900px) { .consent-bar { bottom: 20px; } }
.legal { max-width: 760px; margin: 0 auto; }
.legal h2 { font-size: 18px; margin: 22px 0 6px; }
.legal p, .legal li { color: var(--text-2); line-height: 1.6; font-size: 15px; }
.legal .draft { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #f5a524 16%, var(--surface)); font-size: 13px; }
.checkrow { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); margin: 12px 0 4px; }
.checkrow input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.me-tools { display: grid; gap: 8px; margin-top: 8px; }
.danger-zone .fhelp b { color: var(--text); }
.deleted-note { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, #e5484d 12%, var(--surface)); font-size: 14px; }
.auth-foot .linkbtn, .auth-card .linkbtn { all: unset; cursor: pointer; color: var(--brand); font-weight: 700; display: inline; }
.auth-foot { display: block; text-align: center; margin-top: 14px; font-size: 14px; }
@media (max-width: 480px) {
  .land-nav { gap: 8px; }
  .land-nav .brand span { display: none; }
  .land-nav .anim-note { font-size: 0; padding: 0; width: 34px; height: 34px; justify-content: center; }
  .land-nav .anim-note i { font-size: 16px; margin: 0; }
  .land-nav .actions { gap: 5px; }
  .land-nav .actions .iconbtn { width: 34px; height: 34px; }
}

/* ---- v9: Continue with Google, compact sign-up ---- */
.google-wrap { margin: 18px 0 4px; }
.google-wrap .auth-or { margin: 16px 0 6px; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 18px; border-radius: 14px; background: #fff; color: #1f1f1f; border: 1.5px solid #dadce0; font: 600 15px/1 var(--font, inherit); cursor: pointer; text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.06); transition: box-shadow .15s, transform .1s; }
.gbtn:hover { box-shadow: 0 3px 10px rgba(0,0,0,.14); }
.gbtn:active { transform: scale(.98); }
.gbtn.is-off { opacity: .55; cursor: not-allowed; box-shadow: none; }
.more-fields { margin: 4px 0 10px; }
.more-fields summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; padding: 6px 0; }
