/* =========================================================================
   Application shells: public header, patient app, clinical console
   ========================================================================= */

/* ---------- Public header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(234,234,234,.9);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5);
  height: var(--header-h); max-width: var(--content-max); margin-inline: auto; padding-inline: var(--sp-5);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-weight: 750; font-size: 1.14rem; letter-spacing: -0.03em; }
.brand:hover { color: var(--ink); }
.brand__mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--red-500), var(--red-700)); color: #fff;
  box-shadow: var(--sh-red);
}
.brand__mark svg { width: 18px; height: 18px; }

.site-nav { display: flex; align-items: center; gap: var(--sp-2); }
.site-nav a {
  padding: 9px 14px; border-radius: var(--r-pill); color: var(--ink-2);
  font-weight: 600; font-size: var(--step--1); transition: all .16s var(--ease);
}
.site-nav a:hover { background: var(--line-2); color: var(--ink); }
.site-nav a.is-active { color: var(--red-600); background: var(--red-050); }

.nav-toggle { display: none; background: none; border: 0; padding: 8px; border-radius: var(--r-md); color: var(--ink); cursor: pointer; }
.nav-toggle:hover { background: var(--line-2); }

.mobile-menu {
  position: fixed; inset: var(--header-h) 0 0; background: #fff; z-index: 99;
  padding: var(--sp-6) var(--sp-5); overflow-y: auto;
  animation: fade-in .18s var(--ease);
}
.mobile-menu a { display: block; padding: 16px 4px; font-family: var(--font-display); font-size: var(--step-2); font-weight: 650; color: var(--ink); border-bottom: 1px solid var(--line-2); letter-spacing: -0.02em; }
.mobile-menu .btn { margin-top: var(--sp-6); }

@media (max-width: 900px) {
  .site-nav { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  background: #120508;
  color: rgba(255,255,255,.62);
  padding-block: clamp(56px, 7vw, 96px) var(--sp-6);
  margin-top: clamp(56px, 7vw, 104px);
  overflow: hidden;
}
.site-footer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 120% at 12% -10%, rgba(225,38,47,.20), transparent 62%),
    radial-gradient(50% 90% at 92% 0%, rgba(176,131,39,.12), transparent 60%);
}
.site-footer > * { position: relative; z-index: 1; }
.site-footer a { color: rgba(255,255,255,.66); display: block; padding: 15px 11px; font-size: var(--step--1); }
.site-footer a:hover { color: #fff; }
.site-footer .brand, .site-footer .brand:hover { color: #fff; display: inline-flex; }

/* The close: statement + the action it earns. The measure lives on the text
   element itself so `em` resolves against the display size, not the footer's
   inherited 15px — which is what collapsed it into a word-column. */
.foot-top {
  display: grid; gap: clamp(28px, 4vw, 64px); align-items: end;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  padding-bottom: clamp(36px, 4vw, 56px);
  margin-bottom: clamp(32px, 4vw, 48px);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
@media (max-width: 800px) { .foot-top { grid-template-columns: 1fr; align-items: start; } }

.foot-statement {
  margin: 0; max-width: 17em;
  font-family: "Fraunces", "Plus Jakarta Sans", Georgia, serif;
  font-size: clamp(1.6rem, .9rem + 2.4vw, 2.7rem);
  line-height: 1.08; letter-spacing: -.03em; color: #fff; font-weight: 600;
  text-wrap: balance;
}
.foot-statement em {
  font-style: italic; font-variation-settings: "SOFT" 60, "WONK" 1;
  background: linear-gradient(96deg, #FFC9CD, #E5C26A);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.foot-cta {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-xl); padding: var(--sp-5);
}
.foot-cta__k {
  margin: 0 0 4px; font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.55);
}
.foot-cta__v { margin: 0 0 var(--sp-4); font-size: var(--step--1); color: rgba(255,255,255,.78); }
.foot-cta__alt {
  display: block !important; text-align: center; margin-top: 10px;
  font-size: var(--step--1); color: rgba(255,255,255,.6) !important;
}
.foot-cta__alt:hover { color: #fff !important; }

/* Emergency notice — deliberately impossible to skim past */
.foot-alarm {
  display: flex; gap: var(--sp-4); align-items: flex-start;
  padding: var(--sp-5); margin-bottom: clamp(40px, 5vw, 64px);
  border-radius: var(--r-lg);
  background: rgba(225,38,47,.11);
  border: 1px solid rgba(225,38,47,.34);
}
.foot-alarm__icon { color: #FF8A90; flex: none; margin-top: 1px; }
.foot-alarm p { margin: 0; font-size: var(--step--1); line-height: 1.65; color: rgba(255,255,255,.82); }
.foot-alarm strong { color: #fff; }
.foot-alarm a { display: inline; padding: 0; color: #FFC9CD; text-decoration: underline; font-weight: 640; }

.foot-grid { display: grid; gap: clamp(26px, 3vw, 44px); grid-template-columns: 1fr; }
@media (min-width: 620px)  { .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) {
  .foot-grid { grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr)); }
}
.foot-col h4 {
  color: rgba(255,255,255,.5); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; margin-bottom: var(--sp-3); font-weight: 700;
  font-family: var(--font-mono);
}
.foot-col--brand { max-width: 26rem; }
.foot-note { font-size: var(--step--1); line-height: 1.65; margin: var(--sp-4) 0 var(--sp-5); color: rgba(255,255,255,.6); }
.foot-spacer { height: var(--sp-5); }

.foot-address { margin: 0 0 var(--sp-3); font-size: var(--step--1); line-height: 1.6; color: rgba(255,255,255,.6); }
.foot-address strong { display: block; color: #fff; font-weight: 620; margin-bottom: 4px; }
.foot-address span { display: block; }
.foot-strong {
  display: inline-flex !important; align-items: center; gap: 7px;
  color: #fff !important; font-weight: 640; font-size: var(--step-0) !important;
  padding: 4px 0 !important;
}
.foot-hours {
  margin: var(--sp-3) 0 0; font-size: var(--step--1); line-height: 1.7;
  color: rgba(255,255,255,.72);
}

.foot-hours .luv-icon { vertical-align: -2px; margin-right: 5px; }

.foot-rail {
  margin-top: clamp(40px, 5vw, 64px); padding-top: var(--sp-5);
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6);
  justify-content: space-between; align-items: center;
  font-size: .74rem; color: rgba(255,255,255,.55);
}
.foot-rail__mid { flex: 1; min-width: 240px; text-align: center; }
@media (max-width: 760px) { .foot-rail__mid { text-align: left; } }

/* ---------- App shell (patient + console) ---------- */
.app { display: flex; min-height: 100vh; background: var(--canvas); }

.app-sidebar {
  position: sticky; top: 0; align-self: flex-start; flex: none;
  width: var(--sidebar-w); height: 100vh; background: #fff;
  border-right: 1px solid var(--line); padding: var(--sp-5) var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-2); overflow-y: auto;
}
.app-sidebar .brand { margin: var(--sp-2) var(--sp-2) var(--sp-6); }
.side-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 11px 13px; border-radius: var(--r-md); color: var(--ink-2);
  font-weight: 600; font-size: var(--step-0); transition: all .16s var(--ease);
}
.side-link:hover { background: var(--canvas); color: var(--ink); }
.side-link.is-active { background: var(--red-050); color: var(--red-700); font-weight: 680; }
.side-link.is-active .luv-icon { color: var(--red-500); }
.side-link__count { margin-left: auto; background: var(--red-500); color: #fff; font-size: .68rem; font-weight: 700; border-radius: var(--r-pill); padding: 2px 7px; min-width: 20px; text-align: center; }
.side-group { margin-top: var(--sp-5); padding: 0 13px 6px; font-size: .68rem; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-4); font-weight: 750; }
.app-sidebar__foot { margin-top: auto; padding-top: var(--sp-5); border-top: 1px solid var(--line-2); }
.side-user { padding: 0 13px 12px; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--header-h); padding-inline: var(--sp-5);
  background: rgba(250,250,250,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-topbar__title { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); letter-spacing: -0.025em; margin: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: var(--r-md); border: 0; background: transparent; color: var(--ink-2);
  cursor: pointer; position: relative; transition: background-color .16s var(--ease);
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn__dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red-500); border: 2px solid var(--canvas); }

.app-body { flex: 1; padding: var(--sp-6) var(--sp-5) calc(var(--mobile-nav-h) + var(--sp-8)); max-width: 1120px; width: 100%; }
.app-body--wide { max-width: 1400px; }
.app-body--flush { padding-inline: 0; }

.page-head { margin-bottom: var(--sp-6); }
.page-head h1 { margin-bottom: var(--sp-2); }
.page-head p { color: var(--ink-3); margin: 0; }

/* Mobile bottom navigation */
.mobile-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  display: none; align-items: stretch;
  background: rgba(255,255,255,.94); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 9px 2px; height: var(--mobile-nav-h);
  color: var(--ink-4); font-size: .66rem; font-weight: 650; font-family: var(--font-display);
}
.mobile-nav a.is-active { color: var(--red-600); }
.mobile-nav__fab {
  flex: none; width: 62px; display: grid; place-items: center;
}
.mobile-nav__fab span {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--red-500), var(--red-700)); color: #fff;
  box-shadow: var(--sh-red); margin-top: -22px; border: 4px solid var(--canvas);
}

@media (max-width: 900px) {
  .app-sidebar { display: none; }
  .mobile-nav { display: flex; }
  .app-body { padding-inline: var(--sp-4); }
}
@media (min-width: 901px) {
  .app-body { padding-bottom: var(--sp-9); }
}

/* Sticky mobile action bar */
.sticky-actions {
  position: sticky; bottom: 0; z-index: 50;
  background: linear-gradient(to top, var(--canvas) 62%, rgba(250,250,250,0));
  padding: var(--sp-5) 0 var(--sp-4); margin-top: var(--sp-6);
}
@media (max-width: 900px) {
  .sticky-actions { position: fixed; left: 0; right: 0; bottom: var(--mobile-nav-h); padding: var(--sp-4); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); margin: 0; }
  .has-sticky-actions .app-body { padding-bottom: calc(var(--mobile-nav-h) + 100px); }
}

/* Split view — inbox / conversation */
.split { display: grid; grid-template-columns: 380px 1fr; gap: 0; min-height: calc(100vh - var(--header-h)); }
.split__list { border-right: 1px solid var(--line); background: #fff; overflow-y: auto; max-height: calc(100vh - var(--header-h)); }
.split__detail { min-width: 0; display: flex; flex-direction: column; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } .split__list { border-right: 0; max-height: none; } }

.list-item {
  display: flex; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-2); color: inherit; transition: background-color .14s var(--ease);
}
.list-item:hover { background: var(--canvas); color: inherit; }
.list-item.is-active { background: var(--red-050); box-shadow: inset 3px 0 0 var(--red-500); }
.list-item.is-unread .list-item__title { font-weight: 720; }
.list-item__title { font-family: var(--font-display); font-weight: 620; font-size: var(--step-0); letter-spacing: -0.015em; }

.composer {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: var(--sp-4) var(--sp-5); display: flex; gap: var(--sp-3); align-items: flex-end;
}
.composer textarea { min-height: 52px; max-height: 180px; border-radius: var(--r-lg); }

/* Clinical patient chart sidebar */
.chart-rail { width: 320px; flex: none; border-left: 1px solid var(--line); background: #fff; padding: var(--sp-5); overflow-y: auto; }
@media (max-width: 1200px) { .chart-rail { display: none; } }
.rail-block + .rail-block { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--line-2); }
.rail-block h4 { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); margin-bottom: var(--sp-3); font-weight: 750; }
.rail-fact { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--step--1); padding: 4px 0; }
.rail-fact dt { color: var(--ink-3); }
.rail-fact dd { margin: 0; font-weight: 620; text-align: right; }
.self-reported { font-size: .68rem; color: var(--amber-500); background: var(--amber-050); padding: 2px 7px; border-radius: var(--r-pill); font-weight: 650; }
