/* ============================================================
   Carely Companion App — Shared Styles
   ============================================================ */

:root {
  --bg:        #050A14;
  --bg2:       #070D1A;
  --bg3:       #0C1424;
  --teal:      #00B4D8;
  --mint:      #02C39A;
  --red:       #EF4444;
  --red-dim:   rgba(239,68,68,0.12);
  --text:      #EEF2FF;
  --muted:     #7A8499;
  --dim:       #3D4A5C;
  --glass:     rgba(255,255,255,0.04);
  --glass-hi:  rgba(255,255,255,0.08);
  --border:    rgba(255,255,255,0.07);
  --border-hi: rgba(0,180,216,0.25);
  --grad:      linear-gradient(135deg,#00B4D8,#02C39A);
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px;
  --sidebar-w: 256px;
  --topbar-h:  62px;
  --botnav-h:  68px;
  /* Per-section accent (overridden by body.theme-* below) */
  --accent:      #00B4D8;
  --accent2:     #02C39A;
  --accent-soft: rgba(0,180,216,.12);
}

/* ── Per-section themes — each page feels distinct ──────────── */
body.theme-dashboard { --accent:#00B4D8; --accent2:#02C39A; --accent-soft:rgba(0,180,216,.12); }
body.theme-profile   { --accent:#A78BFA; --accent2:#8B5CF6; --accent-soft:rgba(167,139,250,.14); } /* purple — notes */
body.theme-reminders { --accent:#22D3EE; --accent2:#06B6D4; --accent-soft:rgba(34,211,238,.14); } /* cyan — matches patient app reminders */
body.theme-contacts  { --accent:#34D399; --accent2:#10B981; --accent-soft:rgba(52,211,153,.14);  } /* green */
body.theme-data      { --accent:#FB923C; --accent2:#F97316; --accent-soft:rgba(251,146,60,.14);  } /* orange */
body.theme-insights  { --accent:#6366F1; --accent2:#4F46E5; --accent-soft:rgba(99,102,241,.14);  } /* indigo */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Dark on <html> too, so a full-page navigation never flashes white for a frame
   between the old page unloading and the new one painting — this is what made
   page switches feel like a jarring "reload". */
html { font-size: 16px; background: var(--bg); }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
h1,h2,h3,h4,h5 { font-family: 'Space Grotesk', sans-serif; line-height: 1.15; }
input, textarea, select {
  font-family: inherit;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 12px 15px;
  /* Must be >=16px or iOS Safari auto-zooms on focus (and won't zoom back). */
  font-size: 16px;
  width: 100%;
  transition: border-color .2s;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--teal); }
input::placeholder, textarea::placeholder { color: var(--muted); }
/* Kill the browser's white/yellow autofill background — keep the dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg3) inset;
  box-shadow: 0 0 0 1000px var(--bg3) inset;
  caret-color: var(--text);
  transition: background-color 99999s ease-in-out 0s;
}
label { font-size: 14px; font-weight: 500; color: var(--muted); display: block; margin-bottom: 6px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .15s;
  border: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-ghost   { background: var(--glass-hi); color: var(--text); border: 1px solid var(--border); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger-ghost { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-sm { padding: 9px 15px; font-size: 14px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── App Shell ───────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px; font-weight: 700;
}
.sidebar-logo img { width: 32px; height: 32px; border-radius: 9px; }
.sidebar-patient {
  margin: 16px 16px 8px;
  padding: 12px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.sidebar-patient-name { font-size: 15px; font-weight: 600; }
.sidebar-patient-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 10px 10px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: var(--r-sm);
  font-size: 16px; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--glass-hi); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
/* Settings uses a neutral GRAY active state (not the cyan accent), matching its gray theme. */
.nav-item[data-page="settings.html"].active { background: rgba(148,163,184,0.14); color: #CBD5E1; }
.nav-item[data-page="settings.html"].active svg { color: #CBD5E1; }
.botnav-item[data-page="settings.html"].active { color: #CBD5E1; }
.nav-item svg { width: 23px; height: 23px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.sidebar-logout {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: var(--r-sm);
  font-size: 15px; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-logout svg { width: 19px; height: 19px; }
.sidebar-logout:hover { background: var(--glass-hi); color: var(--text); }

/* Main content area */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 32px;
}

/* Top bar (mobile) */
.topbar {
  display: none;
  align-items: center; justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 90;
}
.topbar-logo { display: flex; align-items: center; gap: 8px; font-family: 'Space Grotesk',sans-serif; font-size: 16px; font-weight: 700; }
.topbar-logo img { width: 26px; height: 26px; border-radius: 6px; }
.burger { background: none; color: var(--text); padding: 6px; }
.burger svg { display: block; }

/* Bottom nav (mobile) */
.botnav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--botnav-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 0;
  align-items: stretch;
}
/* Icon-only cells: every tab is an equal-width box (flex-basis 0), no labels. */
.botnav-item {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  flex: 1 1 0; min-width: 0; cursor: pointer;
  color: var(--muted);
  transition: color .15s;
}
/* Vertical separator between cells, inset from the top and bottom edges. */
.botnav-item + .botnav-item::before {
  content: ""; position: absolute; left: 0; top: 24%; bottom: 24%;
  width: 1px; background: var(--border);
}
.botnav-item svg { width: 24px; height: 24px; }
.botnav-item.active { color: var(--teal); }

/* Overlay for sidebar on mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}

/* ── Page header ─────────────────────────────────────────── */
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 29px; font-weight: 700; }
.page-head p { font-size: 16px; color: var(--muted); margin-top: 6px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card-hi { border-color: var(--border-hi); }

/* ── Grid helpers ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ── Form ────────────────────────────────────────────────── */
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ── Stat chips ──────────────────────────────────────────── */
.stat-chip {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
}
.stat-chip .num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-chip .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Tags ────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  background: rgba(0,180,216,.12);
  color: var(--teal);
}
.tag-green { background: rgba(2,195,154,.12); color: var(--mint); }
.tag-red   { background: var(--red-dim); color: var(--red); }
.tag-dim   { background: var(--glass-hi); color: var(--muted); }

/* ── List items ──────────────────────────────────────────── */
.list-item {
  display: flex; align-items: center; gap: 15px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
  width: 48px; height: 48px; border-radius: var(--r-md);
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.list-item-icon svg { width: 25px; height: 25px; color: var(--accent); }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 17.5px; font-weight: 600; }
.list-item-sub { font-size: 14px; color: var(--muted); margin-top: 3px; }
.list-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.list-item-actions .btn-sm svg { width: 18px; height: 18px; }

/* ── Column tables (reminders / contacts) ────────────────── */
/* auto-fit so columns wrap to fewer-per-row instead of becoming ultra-thin on
   narrow / phone screens (no more 2-words-per-line boxes). */
.col-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.col-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.col-grid-2 > *, .col-grid-3 > * { min-width: 0; }
.col-card {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px 20px 8px; min-width: 0;
}
.col-head {
  display: flex; align-items: center; gap: 9px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
}
.col-head .col-ico {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.col-head .col-ico svg { width: 17px; height: 17px; }
.col-head .col-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.col-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.col-item:last-child { border-bottom: none; }
.col-item-body { flex: 1; min-width: 0; }
.col-item-name { font-size: 16px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.col-item-sub  { font-size: 13.5px; color: var(--muted); margin-top: 3px; word-break: break-word; }
/* Time pill above the item text — coloured to its column (matches the patient app). */
.col-time-pill {
  display: inline-block; margin-bottom: 7px;
  padding: 2px 10px; border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
/* Native time picker: dark theme so the clock icon is light, not black. */
input[type="time"] { color-scheme: dark; }
.col-item-del  {
  flex-shrink: 0; background: var(--red-dim); color: var(--red);
  border: 1px solid rgba(239,68,68,.3); border-radius: 9px;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.col-item-del svg { width: 17px; height: 17px; }
.col-empty { padding: 22px 0; color: var(--muted); font-size: 14px; text-align: center; }
/* Radar/SVG charts never overflow their card on small screens */
.radar-glow, .radar-wrap svg, #cii-content svg { max-width: 100%; height: auto; }

/* ── Emergency button ────────────────────────────────────── */
.emergency-btn {
  width: 100%; padding: 18px;
  background: linear-gradient(135deg,#ef4444,#dc2626);
  border: none; border-radius: var(--r-lg);
  color: #fff; font-family: 'Space Grotesk',sans-serif;
  font-size: 17px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 0 30px rgba(239,68,68,.25);
  transition: box-shadow .2s, transform .15s;
}
.emergency-btn:hover { box-shadow: 0 0 45px rgba(239,68,68,.4); }
.emergency-btn:active { transform: scale(0.98); }
.emergency-btn svg { width: 22px; height: 22px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 100%; max-width: 440px;
  transform: translateY(16px); transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal h3 { font-size: 21px; margin-bottom: 8px; }
.modal p  { font-size: 15px; color: var(--muted); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 80px; right: 20px;
  z-index: 300; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
  animation: toast-in .25s ease;
}
.toast.success { border-color: rgba(2,195,154,.4); }
.toast.error   { border-color: rgba(239,68,68,.4); color: var(--red); }
@keyframes toast-in { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

/* ── Loading / skeleton ──────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--glass) 25%, var(--glass-hi) 50%, var(--glass) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.w-half { width: 50%; }
.skeleton-line.w-third { width: 33%; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--glass); padding: 4px; border-radius: var(--r-sm); width: fit-content; }
.tab { padding: 9px 18px; border-radius: var(--r-sm); font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.tab.active { background: var(--bg2); color: var(--text); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 14px; opacity: .35; }
.empty-state p { font-size: 16px; }

/* ── Grad text ───────────────────────────────────────────── */
.grad-text { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* ── Boot splash — ported 1:1 from the patient app's high-quality loader ───── */
#carely-boot {
  position: fixed; inset: 0; z-index: 9999;
  background: #020810;
  display: flex; align-items: center; justify-content: center;
  pointer-events: all; overflow: hidden;
}
#carely-boot.out { opacity: 0; pointer-events: none; transition: opacity 700ms cubic-bezier(0.23,1,0.32,1); }

/* colour bands — energy loading in from the edges */
#carely-boot .lboot-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#carely-boot .lboot-band { position: absolute; width: 160%; left: -30%; border-radius: 50%; will-change: opacity, transform; }
#carely-boot .lb1 { height: 320px; top: -40px; background: radial-gradient(ellipse 75% 50% at 50% 50%, rgba(0,196,240,0.60) 0%, rgba(0,196,240,0.24) 40%, transparent 68%); filter: blur(42px); animation: lbootBand1 1.8s cubic-bezier(0.23,1,0.32,1) 0.1s both; }
#carely-boot .lb2 { height: 220px; bottom: -40px; background: radial-gradient(ellipse 70% 50% at 55% 50%, rgba(2,217,168,0.60) 0%, rgba(2,217,168,0.22) 42%, transparent 68%); filter: blur(60px); animation: lbootBand2 4.2s cubic-bezier(0.77,0,0.175,1) 0.5s both; }
#carely-boot .lb3 { height: 180px; top: 35%; background: radial-gradient(ellipse 55% 50% at 35% 50%, rgba(95,50,220,0.45) 0%, rgba(80,40,200,0.18) 45%, transparent 68%); filter: blur(70px); animation: lbootBand1 5.0s cubic-bezier(0.77,0,0.175,1) 0.8s both; }
@keyframes lbootBand1 { from { opacity: 0; transform: translateY(-40px) scaleX(0.70); } 40% { opacity: 1; } to { opacity: 0.55; transform: translateY(0) scaleX(1); } }
@keyframes lbootBand2 { from { opacity: 0; transform: translateY(40px) scaleX(0.70); } 40% { opacity: 1; } to { opacity: 0.50; transform: translateY(0) scaleX(1); } }

/* three scan sweeps */
#carely-boot .lboot-scan { position: absolute; top: 0; left: 0; right: 0; height: 1px; pointer-events: none; }
#carely-boot .ls1 { background: linear-gradient(90deg, transparent, rgba(0,196,240,0.95) 50%, transparent); box-shadow: 0 0 24px 6px rgba(0,196,240,0.20); animation: lbootScan 1.6s cubic-bezier(0.37,0,0.63,1) 0.1s both; }
#carely-boot .ls2 { background: linear-gradient(90deg, transparent, rgba(2,217,168,0.60) 50%, transparent); box-shadow: 0 0 14px 3px rgba(2,217,168,0.12); animation: lbootScan 2.2s cubic-bezier(0.37,0,0.63,1) 0.5s both; }
#carely-boot .ls3 { background: linear-gradient(90deg, transparent, rgba(139,92,246,0.45) 50%, transparent); animation: lbootScan 3.0s cubic-bezier(0.37,0,0.63,1) 1.0s both; }
@keyframes lbootScan { from { transform: translateY(0); opacity: 1; } 85% { opacity: 0.35; } to { transform: translateY(100vh); opacity: 0; } }

/* dot grid that activates from centre */
#carely-boot .lboot-grid { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(circle, rgba(255,255,255,0.045) 1px, transparent 1px); background-size: 28px 28px; -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, transparent 30%, black 100%); mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, transparent 30%, black 100%); opacity: 0; animation: lbootGridIn 1.8s cubic-bezier(0.23,1,0.32,1) 0.3s forwards; }
@keyframes lbootGridIn { from { opacity: 0; transform: scale(0.90); } to { opacity: 1; transform: scale(1); } }

/* corner brackets */
#carely-boot .lboot-corner { position: absolute; width: 44px; height: 44px; pointer-events: none; opacity: 0; animation: lbootCornerIn 600ms cubic-bezier(0.23,1,0.32,1) both; }
#carely-boot .lbc-tl { top: 20px; left: 20px;  animation-delay: 0.4s; }
#carely-boot .lbc-tr { top: 20px; right: 20px; animation-delay: 0.55s; }
#carely-boot .lbc-bl { bottom: 20px; left: 20px;  animation-delay: 0.7s; }
#carely-boot .lbc-br { bottom: 20px; right: 20px; animation-delay: 0.85s; }
@keyframes lbootCornerIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

/* central stack: orbit logo + wordmark + status */
#carely-boot .loader-body { display: flex; flex-direction: column; align-items: center; gap: 36px; position: relative; z-index: 1; }
#carely-boot .loader-logo-wrap { position: relative; width: 172px; height: 172px; display: flex; align-items: center; justify-content: center; animation: loaderLogoIn 750ms cubic-bezier(0.23,1,0.32,1) 0.3s both; }
@keyframes loaderLogoIn { from { opacity: 0; transform: scale(0.76); } to { opacity: 1; transform: scale(1); } }
#carely-boot .loader-logo-img { width: 140px; height: 140px; object-fit: contain; filter: drop-shadow(0 0 24px rgba(0,196,240,0.58)) drop-shadow(0 0 8px rgba(2,217,168,0.38)); position: relative; z-index: 2; }
#carely-boot .loader-orbit { position: absolute; inset: -8px; border-radius: 50%; border: 1.5px solid rgba(0,196,240,0.07); border-top-color: rgba(0,196,240,0.92); border-right-color: rgba(0,196,240,0.30); animation: loaderSpin 1.4s linear infinite; }
#carely-boot .loader-orbit-2 { position: absolute; inset: -22px; border-radius: 50%; border: 1px solid rgba(2,217,168,0.05); border-bottom-color: rgba(2,217,168,0.58); border-left-color: rgba(2,217,168,0.20); animation: loaderSpin 2.3s linear infinite reverse; }
#carely-boot .loader-pulse { position: absolute; inset: -8px; border-radius: 50%; border: 1px solid rgba(0,196,240,0.28); animation: loaderPulseRing 2.6s cubic-bezier(0.23,1,0.32,1) 1.0s infinite; }
#carely-boot .lp2 { border-color: rgba(2,217,168,0.18); animation: loaderPulseRing 2.6s cubic-bezier(0.23,1,0.32,1) 2.3s infinite; }
@keyframes loaderPulseRing { 0% { transform: scale(1); opacity: 0.75; } 100% { transform: scale(1.65); opacity: 0; } }
@keyframes loaderSpin { to { transform: rotate(360deg); } }
#carely-boot .loader-wordmark { font-family: ui-monospace, SFMono-Regular, 'Cascadia Code', Consolas, monospace; font-size: clamp(22px,4.5vmin,38px); font-weight: 500; letter-spacing: 0.55em; margin-left: 0.55em; color: rgba(255,255,255,0.92); text-transform: uppercase; animation: loaderSlideUp 850ms cubic-bezier(0.23,1,0.32,1) 0.52s both; }
@keyframes loaderSlideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
#carely-boot .lboot-status { font-family: ui-monospace, SFMono-Regular, 'Cascadia Code', Consolas, monospace; font-size: 13px; letter-spacing: 0.22em; margin-left: 0.22em; color: rgba(255,255,255,0.28); animation: loaderFadeIn 500ms cubic-bezier(0.23,1,0.32,1) 1.2s both; }
@keyframes loaderFadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  #carely-boot *, #carely-boot .lboot-band, #carely-boot .lboot-scan, #carely-boot .lboot-grid,
  #carely-boot .lboot-corner, #carely-boot .loader-logo-wrap, #carely-boot .loader-orbit,
  #carely-boot .loader-orbit-2, #carely-boot .loader-pulse, #carely-boot .loader-wordmark,
  #carely-boot .lboot-status { animation: none !important; opacity: 1 !important; transform: none !important; }
  #carely-boot.out { transition-duration: 150ms !important; }
}

/* ── Page transitions — intentionally NONE. Content appears instantly on load
   (no fade/rise-in) and there is no fade-out on navigation. Combined with the dark
   <html> background above, switching pages now reads as an instant swap instead of
   a reload. ── */

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; padding: 16px 16px 80px; }
  .topbar { display: flex; }
  .burger { display: none; }   /* mobile: bottom nav only — no duplicate top menu */
  .botnav { display: flex; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* Custom themed icons (cross-platform inline SVG) */
.cico{width:30px;height:30px;display:inline-block;vertical-align:middle;fill:none;stroke:url(#cgrad);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 0 5px rgba(0,180,216,.35));overflow:visible}

/* ── Match the patient app font (monospace) across the whole portal ───── */
body, h1, h2, h3, h4, h5, h6,
input, textarea, select, button,
.grad-text, .topbar-logo, .boot-word {
  font-family: 'SF Mono','Fira Code','Fira Mono','Consolas','Monaco',monospace !important;
}
