/* App frame: boot splash, route progress, shells (patient + staff), page helpers, placeholder, style guide. */

/* ================================================================ boot & routing */
.boot-splash { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; background: var(--cream); }
.boot-mark { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.9); opacity: .55; } }
.noscript { padding: 24px; text-align: center; color: var(--ink); }

.route-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-progress);
  height: 3px;
  background: linear-gradient(90deg, var(--lavender-2), var(--purple));
  transform-origin: 0 50%;
  transform: scaleX(0);
  opacity: 0;
  pointer-events: none;
}
.route-progress.is-active { opacity: 1; animation: route-progress 8s cubic-bezier(.08, .7, .2, 1) forwards; }
.route-progress.is-done { animation: none; transform: scaleX(1); opacity: 0; transition: transform .18s ease, opacity .25s ease .12s; }
@keyframes route-progress { 0% { transform: scaleX(0); } 15% { transform: scaleX(.35); } 100% { transform: scaleX(.92); } }

/* ================================================================ page helpers (for page authors) */
.page { min-width: 0; animation: page-in var(--dur-3) var(--ease-out); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-6); }
.page-title { font-size: clamp(26px, 3.2vw, 34px); }
.page-sub { margin-top: 6px; color: var(--ink-2); }
.page-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.page-narrow { max-width: 880px; }
.page-center { max-width: var(--patient-w); margin-inline: auto; }
.page-spinner { display: grid; place-items: center; min-height: 40vh; }
.page-error { max-width: 560px; margin: var(--s-12) auto; padding: 0 var(--s-4); }
.page-fatal { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: var(--s-6) var(--s-4); }
.page-fatal-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 440px);
  padding: 40px 28px 32px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  text-align: center;
}
.page-fatal-title { margin-top: 8px; font-size: var(--fs-xl); }
.page-fatal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.bare { min-height: 100vh; min-height: 100dvh; outline: none; background: var(--cream); }

/* ================================================================ patient shell */
.ps { position: relative; min-height: 100vh; min-height: 100dvh; background: var(--cream); overflow-x: clip; }
.ps-glow {
  position: absolute;
  inset: 0 0 auto 0;
  height: 420px;
  background:
    radial-gradient(60% 80% at 15% 0%, rgba(169, 138, 255, .45) 0%, rgba(169, 138, 255, 0) 70%),
    radial-gradient(55% 70% at 90% 10%, rgba(248, 199, 173, .55) 0%, rgba(248, 199, 173, 0) 70%);
  pointer-events: none;
}
.ps-col {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: var(--patient-w);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}
.ps-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding-bottom: 18px; }
.ps-identity { flex: 1; min-width: 0; }
.ps-clinic { display: flex; align-items: center; gap: 12px; min-width: 0; animation: page-in var(--dur-3) var(--ease-out); }
.ps-mono {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--purple);
  color: var(--cream-light);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: .02em;
  box-shadow: 0 8px 18px -8px rgba(37, 0, 142, .6);
}
.ps-clinic-text { min-width: 0; }
.ps-name { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-address { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 13px; color: var(--ink-2); text-decoration: none; min-width: 0; }
.ps-address span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.ps-address:hover { color: var(--purple); }
.ps-lang { flex: none; background: rgba(255, 255, 255, .55); }
.ps-main { flex: 1; outline: none; }
.ps-footer { display: flex; justify-content: center; padding: 40px 0 8px; }
.ps-powered { display: inline-flex; align-items: center; gap: 7px; min-height: var(--touch); color: var(--ink-2); font-size: 12.5px; text-decoration: none; }
.ps-powered svg { color: var(--purple); margin-top: 1px; }
.ps-powered:hover { color: var(--ink); }
@media (min-width: 720px) {
  .ps-col { padding-top: 28px; padding-inline: 24px; }
  .ps-header { padding-bottom: 28px; }
}

/* ================================================================ staff shell */
.ss { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.ss-side { display: none; }
.ss-main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; min-height: 100dvh; }
.ss-top {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0 16px;
  background: rgba(246, 244, 240, .86);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.ss-top-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }
.ss-top-clinic { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-title { display: none; }
.ss-top-spacer { flex: 1; }
.ss-page-actions { display: flex; align-items: center; gap: 8px; }
.ss-page-actions:empty { display: none; }
.ss-top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.ss-top-lang { display: none; }
.ss-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 4px;
  border-radius: var(--radius-pill);
  color: var(--ink);
  transition: background-color var(--dur-2) var(--ease);
}
.ss-user:hover { background: rgba(22, 0, 85, .06); }
.ss-user-name, .ss-user-chevron { display: none; }
.ss-content { flex: 1; min-width: 0; padding: 20px 16px calc(var(--tabbar-h) + 32px + var(--safe-bottom)); outline: none; }
@media (max-width: 639px) {
  .ss-compact-btn { width: var(--btn-h); padding: 0; }
  .ss-compact-btn .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* bottom tab bar (mobile & tablet) */
.ss-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-tabbar);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(251, 249, 247, .94);
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
}
.ss-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
}
.ss-tab .ss-nav-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 30px;
  border-radius: var(--radius-pill);
  transition: background-color var(--dur-2) var(--ease);
}
.ss-tab:hover { color: var(--ink); }
.ss-tab.is-active { color: var(--purple); }
.ss-tab.is-active .ss-nav-icon { background: var(--purple-tint); }
.ss-tab .ss-badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 8px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--cream-light);
}
body:has(.ss-tabbar) { --toast-offset: var(--tabbar-h); }

/* "Más" sheet */
.ss-more { display: grid; gap: 16px; }
.ss-more-list { display: grid; gap: 2px; }
.ss-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.ss-more-item .ss-nav-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--purple-light); color: var(--purple); }
.ss-more-item:hover, .ss-more-item.is-active { background: var(--purple-light); color: var(--ink); }
.ss-more-item .ss-badge {
  margin-left: auto;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--purple);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.ss-more-foot { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.ss-more-lang { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 12px; font-weight: 500; }

/* desktop sidebar */
.ss-side {
  flex-direction: column;
  gap: 20px;
  padding: 22px 14px 16px;
  background: var(--purple-dark);
  color: var(--on-dark);
}
.ss-side :focus-visible { outline: var(--focus-on-dark); }
.ss-brand { display: inline-flex; align-self: flex-start; padding: 4px 10px; border-radius: 8px; }
.ss-clinic { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-md); background: rgba(255, 255, 255, .06); }
.ss-clinic-mono {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--grad-mark);
  color: var(--purple-dark);
  font-size: 13px;
  font-weight: 700;
}
.ss-clinic-text { min-width: 0; }
.ss-clinic-name { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--on-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-clinic-sub { font-size: 12px; color: rgba(251, 249, 247, .6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-nav { display: flex; flex-direction: column; gap: 2px; }
.ss-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--on-dark-2);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.ss-nav-item .ss-nav-icon { display: grid; place-items: center; }
.ss-nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--on-dark); }
.ss-nav-item.is-active { background: rgba(247, 240, 253, .13); color: #fff; }
.ss-nav-item.is-active .ss-nav-icon { color: var(--lavender); }
.ss-nav-item .ss-badge {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--lavender);
  color: var(--purple-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.ss-side-foot { margin-top: auto; }
.ss-live { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--radius-md); background: rgba(255, 255, 255, .05); }
.ss-live-dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgba(251, 249, 247, .35); }
.ss-live[data-status="open"] .ss-live-dot { background: var(--green); }
.ss-live[data-status="open"] .ss-live-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--green);
  opacity: 0;
  animation: live-pulse 2.4s ease-out infinite;
}
.ss-live[data-status="connecting"] .ss-live-dot { background: var(--amber); }
@keyframes live-pulse { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
.ss-live-text { display: grid; line-height: 1.25; min-width: 0; }
.ss-live-label { font-size: 13px; font-weight: 600; color: var(--on-dark); }
.ss-live-sub { font-size: 12px; color: rgba(251, 249, 247, .6); }

@media (min-width: 640px) {
  .ss-top { padding-inline: 20px 16px; }
  .ss-content { padding-inline: 24px; }
}
@media (min-width: 1024px) {
  .ss { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .ss-side { display: flex; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; scrollbar-width: none; }
  .ss-tabbar { display: none; }
  body:has(.ss-tabbar) { --toast-offset: 0px; }
  .ss-top { padding: 0 24px 0 32px; }
  .ss-top-brand { display: none; }
  .ss-title { display: block; font-size: var(--fs-lg); letter-spacing: var(--track-tight); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ss-top-lang { display: inline-flex; }
  .ss-user { padding: 4px 10px 4px 4px; }
  .ss-user-name { display: block; max-width: 160px; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ss-user-chevron { display: block; color: var(--ink-muted); }
  .ss-content { padding: 28px 32px 56px; }
}

/* static previews used by the style guide */
.ss-preview { position: relative; display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 0; height: 100%; overflow: hidden; }
.ss-preview .ss-side { display: flex; position: relative; height: auto; }
.ss-preview .ss-main { min-height: 0; }
.ss-preview .ss-top { position: relative; padding: 0 20px 0 24px; min-height: var(--topbar-h); }
.ss-preview .ss-top-brand { display: none; }
.ss-preview .ss-title { display: block; font-size: var(--fs-lg); letter-spacing: var(--track-tight); }
.ss-preview .ss-top-lang { display: inline-flex; }
.ss-preview .ss-user-name { display: block; font-size: 14px; font-weight: 600; }
.ss-preview .ss-user-chevron { display: block; }
.ss-preview .ss-content { padding: 24px; }
.ss-preview .ss-compact-btn { width: auto; padding: 0 var(--btn-px); }
.ss-preview .ss-compact-btn .btn-label { display: inline; }
.ss-preview.is-mobile { display: flex; flex-direction: column; }
.ss-preview.is-mobile .ss-main { flex: 1; }
.ss-preview.is-mobile .ss-top { padding: 0 10px 0 14px; }
.ss-preview.is-mobile .ss-top-brand { display: flex; }
.ss-preview.is-mobile .ss-title, .ss-preview.is-mobile .ss-top-lang, .ss-preview.is-mobile .ss-user-name, .ss-preview.is-mobile .ss-user-chevron { display: none; }
.ss-preview.is-mobile .ss-compact-btn { width: 36px; padding: 0; }
.ss-preview.is-mobile .ss-compact-btn .btn-label { display: none; }
.ss-preview.is-mobile .ss-content { padding: 16px 14px; overflow: hidden; }
.ss-preview.is-mobile .ss-tabbar { position: relative; display: grid; height: var(--tabbar-h); padding: 0; }

/* ================================================================ placeholder & 404 */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 540px;
  margin: 0 auto;
  padding: 56px 16px;
  text-align: center;
}
.bare .placeholder { justify-content: center; min-height: 100vh; min-height: 100dvh; }
.placeholder-art { position: relative; margin-bottom: 28px; }
.placeholder-orb {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--grad-mark);
  box-shadow: 0 24px 50px -20px rgba(37, 0, 142, .5), inset 0 0 0 8px rgba(255, 255, 255, .35);
  animation: float 5s ease-in-out infinite;
}
.placeholder-spark { position: absolute; color: var(--purple); animation: twinkle 3s ease-in-out infinite; }
.placeholder-spark-a { top: -6px; right: -18px; }
.placeholder-spark-b { bottom: 4px; left: -18px; color: var(--lavender-2); animation-delay: 1.2s; }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes twinkle { 50% { opacity: .35; transform: scale(.8); } }
.placeholder-title { margin-top: 10px; font-size: clamp(26px, 4vw, 34px); }
.placeholder-text { max-width: 42ch; margin-top: 12px; color: var(--ink-2); }
.placeholder-path { margin-top: 18px; padding: 4px 10px; border-radius: 8px; background: var(--purple-light); color: var(--purple); font-size: 13px; }
.placeholder-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 28px; }

/* ================================================================ style guide (/styleguide) */
.sg { min-height: 100vh; background: var(--cream); }
.sg-hero { position: relative; overflow: hidden; padding: 18px 16px 96px; background: var(--grad-hero); }
.sg-hero-mark { position: absolute; right: -90px; top: 40px; pointer-events: none; }
.sg-hero-inner { position: relative; max-width: var(--content-w); margin: 0 auto; }
.sg-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sg-hero-logo { display: inline-flex; padding: 6px 0; }
.sg-hero-lang { background: rgba(255, 255, 255, .45); }
.sg-hero-eyebrow { margin-top: 64px; color: var(--purple-dark); }
.sg-hero-title { max-width: 15ch; margin-top: 14px; }
.sg-hero-lead { max-width: 56ch; margin-top: 18px; color: var(--ink-2); }
.sg-hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.sg-hero-pills span { padding: 6px 12px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .6); font-size: 13px; font-weight: 600; color: var(--purple-dark); }

.sg-layout { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; max-width: var(--content-w); margin: -48px auto 0; padding: 0 16px 80px; }
.sg-toc {
  position: sticky;
  top: 0;
  z-index: 5;
  min-width: 0;
  margin: 0 -16px;
  padding: 10px 16px;
  background: rgba(246, 244, 240, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.sg-toc-title { display: none; }
.sg-toc-list { display: flex; gap: 6px; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.sg-toc-list::-webkit-scrollbar { display: none; }
.sg-toc-list a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.sg-toc-list a:hover { color: var(--ink); background: rgba(22, 0, 85, .05); }
.sg-toc-list a.is-active { color: var(--purple); background: var(--purple-tint); }
.sg-toc-num { font-size: 11px; font-weight: 700; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.sg-toc-list a.is-active .sg-toc-num { color: var(--purple); }
.sg-main { min-width: 0; }
.sg-section { scroll-margin-top: 72px; }
.sg-section + .sg-section { margin-top: 72px; }
.sg-section > * + * { margin-top: 16px; }
.sg-section-head { display: grid; gap: 8px; margin-bottom: 24px; }
.sg-section-title { font-size: clamp(28px, 3.4vw, 38px); }
.sg-section-desc { max-width: 64ch; color: var(--ink-2); }
.sg-sub { font-size: var(--fs-md); font-weight: 600; font-family: var(--font-ui); letter-spacing: 0; margin-top: 28px; }

.sg-demo { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow: hidden; min-width: 0; }
.sg-demo-label { padding: 16px 22px 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.sg-demo-body { flex: 1 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 20px 22px 22px; min-width: 0; }
.sg-demo-body.is-stack { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 16px; }
.sg-demo-body.no-pad { padding: 0; }
.sg-demo-code { margin: 0; padding: 10px 22px; border-top: 1px solid var(--line-soft); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sg-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.sg-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.sg-value { color: var(--purple); }

.sg-brand-tile { position: relative; display: grid; place-items: center; min-height: 180px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow-1); }
.sg-brand-tile.is-dark { background: var(--purple-dark); border-color: transparent; }
.sg-brand-tile.is-grad { background: var(--grad-soft); border-color: transparent; }
.sg-brand-symbol-sm { position: absolute; right: 18px; bottom: 18px; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--purple); }
.sg-gradients { margin-top: 16px; }
.sg-gradient { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 2px; min-height: 140px; padding: 16px 18px; border-radius: var(--radius-lg); text-align: left; box-shadow: var(--shadow-1); }
.sg-gradient-name { font-weight: 600; }
.sg-gradient code { font-size: 12.5px; color: var(--ink-2); }

.sg-proportions { display: flex; overflow: hidden; height: 44px; border-radius: var(--radius-pill); box-shadow: var(--shadow-1); }
.sg-proportions span { display: flex; align-items: center; padding: 0 16px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.sg-proportions span:first-child { color: var(--cream-light); }
.sg-proportions span:nth-child(2) { color: var(--purple-dark); }
.sg-proportions span:last-child { color: #fff; text-shadow: 0 1px 2px rgba(22, 0, 85, .35); }
.sg-swatches { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.sg-swatch { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow-1); text-align: left; transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.sg-swatch:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.sg-swatch-color { height: 84px; border-bottom: 1px solid var(--line-soft); }
.sg-swatch-meta { display: grid; gap: 1px; padding: 10px 12px 12px; }
.sg-swatch-name { font-size: 14px; font-weight: 600; }
.sg-swatch-hex { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sg-swatch-token { font-size: 12px; color: var(--purple); }

.sg-type { padding: 8px 22px; }
.sg-type-row { display: grid; gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--line-soft); align-items: baseline; min-width: 0; }
.sg-type-row:last-child { border-bottom: 0; }
.sg-type-meta { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; color: var(--ink-2); }
.sg-type-meta strong { color: var(--ink); font-size: 13px; }
@media (min-width: 720px) {
  .sg-type-row { grid-template-columns: 170px minmax(0, 1fr); gap: 24px; }
  .sg-type-meta { flex-direction: column; gap: 2px; }
}

.sg-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; padding: 14px; }
.sg-icon { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 6px 12px; border-radius: 12px; color: var(--ink); transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease); }
.sg-icon span { font-size: 11.5px; color: var(--ink-2); text-align: center; word-break: break-word; }
.sg-icon:hover { background: var(--purple-light); color: var(--purple); }

.sg-countdown { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-pill); background: var(--purple-light); color: var(--purple-dark); font-weight: 500; }
.sg-countdown.is-warn { background: var(--danger-tint); color: var(--danger-ink); }

.sg-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.sg-cards .card { display: grid; gap: 4px; min-height: 120px; align-content: end; }
.sg-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.sg-appt { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.sg-appt:last-child { border-bottom: 0; }
.sg-appt-time { flex: none; width: 72px; font-size: 14px; font-weight: 600; }
.sg-appt-bar { flex: none; width: 4px; height: 36px; border-radius: 2px; }
.sg-picked { min-height: 20px; }
.sg-doctor-rows { display: grid; }

.sg-frame { height: 620px; overflow: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow-2); background: var(--bg); }
.sg-frame > .ss-preview { min-width: 940px; }
.sg-phones { display: flex; flex-wrap: wrap; justify-content: center; gap: 40px; margin-top: 40px !important; }
.sg-phone-fig { display: grid; justify-items: center; gap: 14px; margin: 0; }
.sg-phone-fig figcaption { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.sg-phone { width: 360px; max-width: calc(100vw - 32px); height: 740px; padding: 10px; border-radius: 44px; background: var(--purple-dark); box-shadow: var(--shadow-3); }
.sg-phone-screen { position: relative; height: 100%; overflow: hidden auto; border-radius: 34px; background: var(--cream); scrollbar-width: none; }
.sg-phone-screen::-webkit-scrollbar { display: none; }
.sg-phone-screen > .ss-preview { min-height: 100%; }
.sg-phone-screen .ps, .sg-phone-screen .ps-col { min-height: 100%; }
.sg-patient-title { margin-top: 6px; font-size: 28px; }

.sg-dash { display: grid; gap: 16px; }
.sg-dash-hello { font-size: 26px; }
.sg-dash-health h3 { margin-top: 6px; color: var(--on-dark); }

.sg-footer { display: flex; align-items: center; gap: 10px; margin-top: 80px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }

@media (min-width: 720px) {
  .sg-hero { padding: 24px 32px 120px; }
  .sg-hero-eyebrow { margin-top: 88px; }
  .sg-layout { padding: 0 32px 96px; }
  .sg-toc { margin: 0 -32px; padding: 10px 32px; }
}
@media (min-width: 1100px) {
  .sg-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 48px; margin-top: -56px; }
  .sg-toc { top: 24px; align-self: start; margin: 0; padding: 18px 10px; border: 0; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-1); }
  .sg-toc-title { display: block; padding: 0 12px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
  .sg-toc-list { flex-direction: column; gap: 2px; overflow: visible; }
  .sg-toc-list a { width: 100%; min-height: 36px; }
  .sg-section { scroll-margin-top: 24px; }
}
