:root {
  --navy: #102a43;
  --blue: #176b87;
  --cyan: #2ea3b0;
  --ink: #14212b;
  --muted: #607181;
  --line: #dbe5eb;
  --surface: #ffffff;
  --canvas: #edf3f6;
  --soft: #f4f8fa;
  --teal-soft: #e6f4f3;
  --warning: #b85b20;
  --warning-soft: #fff0e6;
  --danger: #b83a3a;
  --danger-soft: #fdecec;
  --success: #18735d;
  --success-soft: #e7f5ef;
  --shadow: 0 18px 55px rgba(16, 42, 67, .14);
}

* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; background:
  radial-gradient(circle at 8% 0%, rgba(46,163,176,.15), transparent 33rem),
  radial-gradient(circle at 96% 96%, rgba(23,107,135,.12), transparent 30rem),
  var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(46,163,176,.35); outline-offset: 2px; }
.app-shell { min-height: 100vh; }

.onboarding-stage { grid-template-columns: minmax(0, 430px); }
.onboarding-phone { background:#071b2a; border-color:rgba(255,255,255,.14); }
.onboarding-flow { flex:1 1 auto; width:100%; height:100%; min-height:0; overflow-y:auto; background:linear-gradient(180deg,#071b2a 0%,#0d3141 48%,#f5faf9 48%); }
.launch-splash { position:absolute; inset:0; min-height:0; height:auto; overflow:hidden; background:#071b2a; color:white; }
.launch-splash-visual { position:absolute; inset:0; overflow:hidden; }
.launch-splash-visual::after { content:""; position:absolute; inset:0; background:linear-gradient(180deg,rgba(4,18,28,.06) 0%,rgba(4,18,28,.18) 42%,rgba(4,18,28,.94) 78%,#071b2a 100%); }
.launch-splash-visual img { width:100%; height:100%; object-fit:cover; object-position:center 48%; display:block; filter:saturate(.9) contrast(1.03); }
.launch-splash-copy { position:absolute; z-index:4; left:0; right:0; bottom:0; padding:28px 24px calc(30px + env(safe-area-inset-bottom)); animation:launch-copy-in .7s .18s ease-out both; }
.launch-brand { display:inline-block; color:#87e8dc; font-size:.78rem; font-weight:850; letter-spacing:.14em; text-transform:uppercase; }
.launch-splash h1 { max-width:360px; margin:10px 0 24px; color:white; font-size:clamp(2rem,8vw,2.65rem); line-height:1.03; letter-spacing:-.047em; }
.launch-progress { height:3px; overflow:hidden; border-radius:9px; background:rgba(255,255,255,.2); }
.launch-progress i { display:block; width:100%; height:100%; border-radius:inherit; background:#83e8dc; transform-origin:left; animation:launch-progress 2s linear both; }
.launch-splash small { display:block; margin-top:10px; color:rgba(255,255,255,.67); font-size:.78rem; }
.onboarding-hero { min-height:100%; display:flex; flex-direction:column; }
.onboarding-visual { position:relative; min-height:52vh; overflow:hidden; background:#071b2a; }
.onboarding-visual::after { content:""; position:absolute; inset:auto 0 0; height:38%; background:linear-gradient(transparent,#071b2a); pointer-events:none; }
.onboarding-visual img { width:100%; height:58vh; object-fit:cover; object-position:center 47%; display:block; filter:saturate(.92) contrast(1.02); animation:onboarding-drift 9s ease-in-out infinite alternate; }
.onboarding-copy { position:relative; z-index:2; margin-top:-44px; padding:18px 22px calc(28px + env(safe-area-inset-bottom)); color:white; }
.onboarding-copy h1,.onboarding-explain h1,.onboarding-role h1,.onboarding-detail h1 { margin:7px 0 10px; font-size:clamp(1.75rem,7vw,2.35rem); line-height:1.04; letter-spacing:-.045em; }
.onboarding-copy h1 { color:white; }
.onboarding-copy p { color:rgba(255,255,255,.78); line-height:1.55; }
.onboarding-copy .hero-kicker { color:#78ddd2; }
.onboarding-copy .primary { margin-top:14px; background:#f4fbfa; color:#0d5360; }
.onboarding-pulse { position:absolute; z-index:3; width:14px; height:14px; border-radius:50%; background:#7ff0dc; box-shadow:0 0 0 0 rgba(127,240,220,.55); transform:translate(-50%,-50%); animation:onboarding-pulse 2.4s ease-out infinite; }
.onboarding-pulse.p1 { left:29.5%; top:60.8%; }
.onboarding-pulse.p2 { left:53.2%; top:52.6%; animation-delay:.45s; }
.onboarding-pulse.p3 { left:63.2%; top:43.9%; animation-delay:.9s; }
.onboarding-pulse.p4 { left:89.7%; top:39.9%; animation-delay:1.35s; }
.launch-splash .onboarding-pulse.p1 { left:30.3%; top:61.41%; }
.launch-splash .onboarding-pulse.p2 { left:53.16%; top:53.41%; }
.launch-splash .onboarding-pulse.p3 { left:62.24%; top:45.03%; }
.launch-splash .onboarding-pulse.p4 { left:87.2%; top:41.34%; }
.onboarding-explain,.onboarding-role,.onboarding-detail { min-height:100%; padding:max(30px,env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom)); background:linear-gradient(180deg,#f8fcfb,#eef7f6); }
.onboarding-explain>p,.onboarding-role>p,.onboarding-detail>p { color:var(--muted); line-height:1.55; }
.onboarding-benefits { display:grid; gap:10px; margin:24px 0; }
.onboarding-benefits article { position:relative; padding:16px 16px 16px 58px; background:white; border:1px solid #dbe9e7; border-radius:18px; }
.onboarding-benefits article>span { position:absolute; left:16px; top:17px; color:#158b8d; font-weight:850; }
.onboarding-benefits p { margin:5px 0 0; color:var(--muted); line-height:1.4; }
.onboarding-role-grid { display:grid; gap:10px; margin:22px 0 16px; }
.onboarding-role-grid button { border:1px solid #d3e7e4; background:white; border-radius:19px; padding:15px; text-align:left; display:grid; grid-template-columns:46px 1fr; column-gap:12px; align-items:center; color:var(--navy); box-shadow:0 8px 26px rgba(16,42,67,.06); }
.onboarding-role-grid button>span { grid-row:1/3; width:46px; height:46px; display:grid; place-items:center; border-radius:15px; color:#147d8c; background:#e2f5f1; }
.onboarding-role-grid button strong { font-size:1rem; }
.onboarding-role-grid button small { color:var(--muted); margin-top:3px; }
.onboarding-detail .card { margin:20px 0 12px; }
.privacy-note { background:#e9f6f3; border-color:#cae7e1; }
.share-panel .share-grid { grid-template-columns:1fr 1fr; }
@keyframes onboarding-drift { from { transform:scale(1.02) translateY(0); } to { transform:scale(1.075) translateY(-8px); } }
@keyframes onboarding-pulse { 0% { box-shadow:0 0 0 0 rgba(127,240,220,.55); transform:translate(-50%,-50%) scale(.9); } 65% { box-shadow:0 0 0 18px rgba(127,240,220,0); transform:translate(-50%,-50%) scale(1.08); } 100% { box-shadow:0 0 0 0 rgba(127,240,220,0); transform:translate(-50%,-50%) scale(.9); } }
@keyframes launch-copy-in { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes launch-progress { from { transform:scaleX(0); } to { transform:scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  .onboarding-visual img,.launch-splash-visual img,.onboarding-pulse,.launch-splash-copy { animation:none !important; }
  .launch-progress i { animation:none !important; transform:scaleX(1); }
}

.desktop-stage { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 430px) minmax(280px, 420px); gap: 28px; justify-content: center; align-items: start; padding: 22px; }
.phone { width: 100%; min-height: calc(100vh - 44px); max-height: calc(100vh - 44px); background: var(--surface); border: 1px solid rgba(16,42,67,.12); border-radius: 30px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.prototype-note { margin-top: 54px; color: var(--navy); padding: 24px; }
.prototype-note h1 { font-size: 2rem; line-height: 1.08; margin: 0 0 14px; letter-spacing: -.035em; }
.prototype-note p { color: var(--muted); line-height: 1.55; }
.route-list { display: grid; gap: 10px; margin-top: 24px; }
.route-chip { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.75); border: 1px solid rgba(16,42,67,.1); border-radius: 15px; padding: 14px; }
.route-chip span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: white; font-weight: 750; }

.topbar { padding: max(18px, env(safe-area-inset-top)) 18px 13px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); z-index: 5; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 11px; background: linear-gradient(145deg, var(--navy), var(--blue)); color: white; display: grid; place-items: center; font-weight: 850; letter-spacing: -.04em; }
.brand-title { font-weight: 800; color: var(--navy); line-height: 1.05; }
.brand-sub { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.role-switch { border: 1px solid var(--line); background: var(--soft); border-radius: 12px; padding: 9px 10px; color: var(--navy); max-width: 145px; }
.context-bar { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: .83rem; color: var(--muted); }
.context-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

.content { flex: 1 1 auto; min-height:0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling:touch; padding: 18px 16px 112px; background: linear-gradient(180deg, #fff 0, #f7fafb 100%); }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
h2 { margin: 0; color: var(--navy); font-size: 1.55rem; line-height: 1.15; letter-spacing: -.025em; }
h3 { margin: 0; color: var(--navy); font-size: 1.05rem; line-height: 1.3; }
.date-pill { white-space: nowrap; font-size: .8rem; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 7px 10px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 24px 2px 10px; }
.section-title button { border: 0; background: transparent; color: var(--blue); padding: 4px; }

.hero-card { background: linear-gradient(145deg, var(--navy), #174c67); color: white; border-radius: 22px; padding: 20px; box-shadow: 0 12px 30px rgba(16,42,67,.16); }
.hero-card h3 { color: white; font-size: 1.25rem; }
.hero-card p { color: rgba(255,255,255,.78); margin: 8px 0 16px; line-height: 1.42; }
.hero-row { display: flex; justify-content: space-between; gap: 12px; align-items: end; }
.metric { font-size: 1.7rem; font-weight: 850; line-height: 1; }
.metric-label { font-size: .76rem; color: rgba(255,255,255,.7); margin-top: 5px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 15px; box-shadow: 0 4px 16px rgba(16,42,67,.045); }
.card + .card { margin-top: 10px; }
.card-row { display: flex; gap: 12px; align-items: flex-start; }
.card-main { flex: 1; min-width: 0; }
.card p { color: var(--muted); margin: 5px 0 0; line-height: 1.4; font-size: .92rem; }
.card-meta { margin-top: 12px; display: flex; gap: 7px; flex-wrap: wrap; }
.icon-box { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; background: var(--teal-soft); color: var(--blue); }
.icon-box.warn { color: var(--warning); background: var(--warning-soft); }
.icon-box.danger { color: var(--danger); background: var(--danger-soft); }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; background: var(--soft); color: var(--muted); padding: 5px 8px; font-size: .74rem; font-weight: 700; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.small-link { color: var(--blue); border: 0; background: transparent; padding: 0; font-weight: 750; }

.primary, .secondary, .danger-btn { min-height: 46px; border-radius: 14px; padding: 11px 15px; font-weight: 780; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary { background: var(--navy); color: white; }
.primary:hover { background: #183c59; }
.secondary { background: var(--teal-soft); color: var(--blue); border: 1px solid rgba(23,107,135,.12); }
.danger-btn { background: var(--danger-soft); color: var(--danger); }
.wide { width: 100%; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick { min-height: 104px; background: white; border: 1px solid var(--line); border-radius: 17px; padding: 14px; text-align: left; color: var(--ink); }
.quick strong { display: block; color: var(--navy); margin-top: 12px; line-height: 1.25; }
.quick span { display: block; color: var(--muted); font-size: .78rem; margin-top: 4px; }

.progress-track { height: 8px; background: #e8eef1; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.week { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; margin-top: 14px; }
.day { display: grid; place-items: center; gap: 6px; font-size: .68rem; color: var(--muted); }
.day i { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: var(--soft); font-style: normal; font-weight: 750; color: var(--navy); }
.day.done i { background: var(--success); color: white; }
.day.today i { box-shadow: inset 0 0 0 2px var(--blue); background: white; }

.bottom-nav { position: absolute; bottom: 0; left: 0; right: 0; z-index: 8; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 8px 5px max(8px, env(safe-area-inset-bottom)); backdrop-filter: blur(16px); }
.nav-item { border: 0; background: transparent; color: #738390; display: grid; justify-items: center; gap: 4px; padding: 4px 1px; font-size: .67rem; min-width: 0; }
.nav-item .nav-icon { width: 25px; height: 25px; border-radius: 9px; display: grid; place-items: center; }
.nav-item.active { color: var(--blue); font-weight: 800; }
.nav-item.active .nav-icon { background: var(--teal-soft); }

.chat { display: flex; flex-direction: column; gap: 11px; }
.bubble { max-width: 88%; border-radius: 17px; padding: 12px 14px; line-height: 1.42; font-size: .92rem; }
.bubble.ai { align-self: flex-start; background: white; border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.user { align-self: flex-end; background: var(--navy); color: white; border-bottom-right-radius: 5px; }
.bubble strong { color: inherit; }
.chat-actions { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.chat-actions button { white-space: nowrap; border: 1px solid var(--line); background: white; color: var(--blue); padding: 8px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.composer { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; position: sticky; bottom: -96px; margin-top: 14px; background: rgba(247,250,251,.95); padding: 10px 0 2px; }
.composer input { min-width: 0; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 12px; color: var(--ink); }
.composer button { width: 44px; height: 44px; border-radius: 14px; border: 0; display: grid; place-items: center; }

.patient-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.patient-chip { flex: 0 0 220px; border: 1px solid var(--line); background: white; border-radius: 16px; padding: 13px; text-align: left; }
.patient-chip.active { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.patient-chip strong { display: block; color: var(--navy); }
.patient-chip span { display: block; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #d9e9ef; display: grid; place-items: center; color: var(--navy); font-weight: 850; }
.list-row { width:100%; display:flex; align-items:center; gap:12px; padding:13px 2px; border:0; border-bottom:1px solid var(--line); background:transparent; text-align:left; color:var(--ink); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { color: var(--navy); display: block; }
.list-row span { color: var(--muted); font-size: .82rem; display: block; margin-top: 3px; }
.chevron { color: #8fa0ad; font-size: 1.3rem; }

.tabs { display: flex; gap: 7px; overflow-x: auto; margin: -2px 0 14px; scrollbar-width: none; }
.tab { flex: 0 0 auto; border: 1px solid var(--line); background: white; color: var(--muted); border-radius: 999px; padding: 8px 11px; font-size: .8rem; }
.tab.active { background: var(--navy); color: white; border-color: var(--navy); }
.timeline { position: relative; padding-left: 24px; }
.timeline:before { content:""; position:absolute; left:8px; top:8px; bottom:8px; width:2px; background:var(--line); }
.event { position: relative; margin-bottom: 14px; }
.event:before { content:""; position:absolute; left:-20px; top:5px; width:10px; height:10px; border-radius:50%; background:var(--cyan); box-shadow:0 0 0 4px white; }
.event time { color:var(--muted); font-size:.75rem; }
.event strong { display:block; color:var(--navy); margin:3px 0; }
.event p { margin:0; color:var(--muted); font-size:.84rem; line-height:1.4; }

.choice-list { display: grid; gap: 9px; }
.choice { width:100%; display:flex; align-items:center; gap:11px; text-align:left; border:1px solid var(--line); background:white; border-radius:15px; padding:13px; color:var(--ink); }
.choice.selected { border-color:var(--blue); background:var(--teal-soft); }
.choice-check { width:22px; height:22px; border-radius:7px; border:2px solid #b6c4cd; display:grid; place-items:center; flex:0 0 auto; color:white; }
.choice.selected .choice-check { background:var(--blue); border-color:var(--blue); }
.stepper { display:flex; align-items:center; gap:6px; margin:4px 0 18px; }
.stepper i { height:5px; flex:1; background:#dfe7eb; border-radius:5px; }
.stepper i.on { background:var(--blue); }
.question { font-size:1.13rem; line-height:1.35; color:var(--navy); margin:0 0 14px; }
.safe-box { border-radius:17px; padding:15px; background:var(--danger-soft); border:1px solid #f6caca; }
.safe-box.warning { background:var(--warning-soft); border-color:#f5d2bd; }
.safe-box.success { background:var(--success-soft); border-color:#c4e6d9; }
.safe-box h3 { color:inherit; }
.safe-box p { margin:7px 0 0; color:inherit; line-height:1.45; }

.exercise { display:grid; grid-template-columns:76px 1fr; gap:12px; align-items:center; }
.exercise-visual { height:76px; border-radius:15px; background:linear-gradient(145deg,#dceaf0,#f4f8fa); display:grid; place-items:center; color:var(--blue); font-weight:850; }
.exercise strong { color:var(--navy); }
.exercise p { margin:4px 0; }
.counter { display:flex; align-items:center; gap:8px; }
.counter button { width:34px; height:34px; border-radius:10px; border:1px solid var(--line); background:white; color:var(--navy); font-weight:800; }
.counter span { min-width:30px; text-align:center; font-weight:800; }

.sheet-backdrop { position:fixed; inset:0; background:rgba(8,28,42,.42); display:flex; justify-content:center; align-items:flex-end; z-index:30; padding:16px; overflow:hidden; }
.sheet { position:relative; width:min(430px,100%); max-height:calc(100dvh - 72px); overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; touch-action:pan-y; background:white; border-radius:24px 24px 18px 18px; padding:20px 18px max(20px,env(safe-area-inset-bottom)); box-shadow:var(--shadow); animation:rise .2s ease-out; }
.sheet.dragging { transition:none; overflow:hidden; }
@keyframes rise { from { transform:translateY(18px); opacity:.6 } }
.sheet-handle { width:54px; height:22px; border-radius:12px; margin:-10px auto 5px; position:relative; touch-action:none; }
.sheet-handle:after { content:""; position:absolute; left:6px; right:6px; top:9px; height:4px; border-radius:4px; background:#aabac4; }
.sheet h2 { font-size:1.35rem; }
.sheet .close { position:sticky; z-index:4; top:0; float:right; margin-top:-22px; border:0; background:var(--soft); width:44px; height:44px; border-radius:13px; color:var(--navy); font-size:1.3rem; box-shadow:0 2px 8px rgba(16,42,67,.06); }
.field { margin-top:14px; }
.field label { display:block; font-size:.79rem; font-weight:780; color:var(--navy); margin-bottom:6px; }
.field input, .field textarea, .field select { width:100%; border:1px solid var(--line); border-radius:13px; padding:12px; color:var(--ink); background:white; }
.field textarea { min-height:86px; resize:vertical; }
.form-actions { display:grid; grid-template-columns:1fr 1.5fr; gap:9px; margin-top:18px; }

.toast { position:fixed; left:50%; bottom:25px; transform:translate(-50%,18px); opacity:0; pointer-events:none; background:var(--navy); color:white; padding:12px 16px; border-radius:13px; box-shadow:var(--shadow); z-index:50; transition:.2s ease; max-width:calc(100vw - 30px); text-align:center; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.empty { text-align:center; padding:34px 20px; color:var(--muted); }
.empty .icon-box { margin:0 auto 12px; }

.chat-toolbar { display:flex; gap:8px; margin:-3px 0 12px; }
.chat-toolbar button { min-height:38px; display:inline-flex; align-items:center; gap:6px; padding:8px 11px; font-size:.76rem; }
.attachment-chip { display:flex; align-items:center; gap:7px; margin:10px 0 7px; padding:9px 11px; border:1px solid #c7e1e4; border-radius:13px; background:var(--teal-soft); color:var(--blue); font-size:.78rem; font-weight:750; }
.attachment-chip span { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.attachment-chip button { border:0; background:transparent; color:var(--blue); font-size:1.2rem; line-height:1; }

.academy-link { margin-left:auto; border:0; background:var(--teal-soft); color:var(--blue); border-radius:999px; padding:6px 10px; display:inline-flex; align-items:center; gap:5px; font-size:.76rem; font-weight:800; }
.academy-banner { width:100%; border:0; color:white; background:linear-gradient(135deg,#184c67,#167585); border-radius:19px; padding:15px; display:flex; align-items:center; gap:12px; text-align:left; box-shadow:0 8px 23px rgba(23,107,135,.18); }
.academy-banner.compact { margin-top:2px; }
.academy-banner-icon { width:46px; height:46px; flex:0 0 auto; display:grid; place-items:center; border-radius:14px; background:rgba(255,255,255,.14); }
.academy-banner-copy { flex:1; min-width:0; display:grid; gap:5px; }
.academy-banner-copy strong { font-size:1rem; }
.academy-banner-copy small { color:rgba(255,255,255,.75); line-height:1.35; }
.academy-banner .chevron { color:white; }
.academy-banner .progress-track { margin-top:3px; background:rgba(255,255,255,.16); }
.academy-banner .progress-fill { background:white; }
.academy-tabs { display:grid; grid-template-columns:repeat(4,1fr); gap:5px; background:var(--soft); border:1px solid var(--line); padding:5px; border-radius:15px; margin-bottom:14px; }
.academy-tab { border:0; background:transparent; color:var(--muted); border-radius:11px; min-height:38px; padding:7px 4px; font-size:.76rem; font-weight:750; }
.academy-tab.active { background:white; color:var(--navy); box-shadow:0 2px 8px rgba(16,42,67,.08); }
.academy-hero { background:linear-gradient(145deg,#102a43,#176b87); border-radius:20px; color:white; padding:18px; display:flex; justify-content:space-between; align-items:center; gap:13px; }
.academy-hero.cases { background:linear-gradient(145deg,#173f55,#247b70); }
.academy-hero.exam { background:linear-gradient(145deg,#3d315b,#176b87); }
.academy-hero.progress { background:linear-gradient(145deg,#153f58,#18735d); }
.academy-hero h3 { color:white; font-size:1.2rem; margin:4px 0 0; }
.academy-hero p { color:rgba(255,255,255,.78); margin:6px 0 0; line-height:1.38; font-size:.84rem; }
.academy-kicker { font-size:.7rem; font-weight:850; text-transform:uppercase; letter-spacing:.08em; color:#a9e3e3; }
.progress-orb { width:72px; height:72px; flex:0 0 auto; border-radius:50%; border:5px solid rgba(255,255,255,.22); box-shadow:inset 0 0 0 2px rgba(255,255,255,.12); display:grid; place-items:center; align-content:center; }
.progress-orb strong { font-size:1.05rem; line-height:1; }
.progress-orb span { font-size:.64rem; color:rgba(255,255,255,.72); margin-top:4px; }
.academy-resume { background:white; border:1px solid var(--line); border-radius:18px; padding:15px; margin-top:11px; }
.module-list { display:grid; gap:9px; }
.module-card { width:100%; border:1px solid var(--line); background:white; border-radius:16px; padding:13px; display:grid; grid-template-columns:38px 1fr auto; gap:11px; align-items:center; color:var(--ink); text-align:left; }
.module-card.locked { opacity:.55; background:var(--soft); }
.module-number, .lesson-index { width:34px; height:34px; border-radius:11px; background:var(--teal-soft); color:var(--blue); display:grid; place-items:center; font-size:.76rem; font-weight:850; }
.module-copy { min-width:0; display:grid; gap:4px; }
.module-copy strong { color:var(--navy); line-height:1.25; }
.module-copy small { color:var(--muted); line-height:1.3; }
.module-copy .progress-track { height:5px; margin-top:4px; }
.module-status { color:var(--muted); font-size:.68rem; max-width:72px; text-align:right; line-height:1.25; }
.module-status.done { color:var(--success); font-weight:800; }
.source-note { display:flex; gap:9px; align-items:flex-start; color:var(--muted); background:var(--soft); border-radius:14px; padding:12px; margin-top:14px; font-size:.78rem; line-height:1.4; }
.source-note svg { flex:0 0 auto; color:var(--blue); }
.case-card { background:white; border:1px solid var(--line); border-radius:19px; padding:16px; }
.case-card p { color:var(--muted); line-height:1.45; }
.case-label { display:inline-flex; color:var(--blue); background:var(--teal-soft); border-radius:999px; padding:6px 9px; font-size:.72rem; font-weight:800; margin-bottom:9px; }
.stats-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.stat-card { border:1px solid var(--line); background:white; border-radius:16px; padding:14px; display:grid; gap:5px; }
.stat-card strong { color:var(--navy); font-size:1.45rem; }
.stat-card span { color:var(--muted); font-size:.76rem; line-height:1.3; }
.progress-row { padding:10px 0; border-bottom:1px solid var(--line); }
.progress-row:last-child { border-bottom:0; }
.progress-row>div:first-child { display:flex; justify-content:space-between; gap:10px; margin-bottom:8px; font-size:.8rem; }
.progress-row span { color:var(--muted); }
.lesson-list { display:grid; gap:7px; margin-top:15px; }
.lesson-row { width:100%; border:1px solid var(--line); background:white; border-radius:14px; padding:11px; display:grid; grid-template-columns:34px 1fr auto; gap:10px; align-items:center; text-align:left; color:var(--ink); }
.lesson-row.locked { opacity:.52; background:var(--soft); }
.lesson-row strong, .lesson-row small { display:block; }
.lesson-row strong { color:var(--navy); line-height:1.3; }
.lesson-row small { color:var(--muted); margin-top:3px; }
.lesson-callout, .case-context { display:flex; gap:11px; align-items:flex-start; background:var(--teal-soft); color:var(--navy); border-radius:16px; padding:14px; margin-top:14px; }
.lesson-callout>span { width:38px; height:38px; flex:0 0 auto; border-radius:11px; display:grid; place-items:center; background:white; color:var(--blue); }
.lesson-callout p, .case-context p { margin:5px 0 0; color:var(--muted); line-height:1.45; }
.case-context { display:block; }
.learning-list { padding-left:21px; color:var(--ink); line-height:1.55; }
.academy-specialty { display:grid; gap:6px; margin-bottom:12px; }
.academy-specialty label { color:var(--muted); font-size:.76rem; font-weight:750; }
.academy-specialty select { width:100%; border:1px solid var(--line); border-radius:13px; background:white; color:var(--navy); padding:11px 12px; font-weight:700; }
.academy-inventory { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin:10px 0 0; }
.academy-inventory span { background:white; border:1px solid var(--line); border-radius:12px; padding:9px 5px; color:var(--muted); font-size:.67rem; text-align:center; line-height:1.2; }
.academy-inventory strong { display:block; color:var(--navy); font-size:1rem; margin-bottom:2px; }
.academy-search { display:grid; grid-template-columns:1fr auto; gap:7px; margin-top:12px; }
.academy-search input { min-width:0; border:1px solid var(--line); border-radius:13px; background:white; color:var(--ink); padding:11px 12px; }
.search-results { max-height:330px; overflow:auto; }
.case-button { width:100%; text-align:left; color:var(--ink); }
.case-button .small-link { display:block; margin-top:12px; }
.module-summary { display:flex; gap:7px; margin-top:12px; }
.module-summary span, .module-quiz-chip { min-height:44px; display:inline-flex; align-items:center; background:var(--soft); color:var(--muted); border-radius:999px; padding:8px 13px; font-size:.78rem; font-weight:700; }
.module-quiz-chip { border:1px solid #c7e1e4; background:var(--teal-soft); color:var(--blue); cursor:pointer; gap:7px; }
.module-quiz-chip:active { transform:scale(.98); }
.module-quiz-chip b { font-size:1rem; }
.module-quiz-primary { margin-top:12px; }
.sheet-intro { color:var(--muted); line-height:1.5; }
.presentation-backdrop { position:fixed; inset:0; z-index:60; background:#eef4f6; display:flex; justify-content:center; }
.presentation { width:min(100%,760px); height:100%; background:white; display:grid; grid-template-rows:auto 5px 1fr auto; overflow:hidden; box-shadow:0 0 44px rgba(16,42,67,.16); }
.presentation-head { display:grid; grid-template-columns:44px 1fr 44px; gap:10px; align-items:center; padding:max(12px,env(safe-area-inset-top)) 14px 12px; background:var(--navy); color:white; }
.presentation-head>div { min-width:0; text-align:center; display:grid; gap:2px; }
.presentation-head span { color:rgba(255,255,255,.7); font-size:.72rem; }
.presentation-head strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.88rem; }
.presentation-close, .presentation-menu { width:44px; height:44px; border:0; border-radius:13px; background:rgba(255,255,255,.12); color:white; font-size:1.5rem; }
.presentation-menu { font-size:1rem; }
.presentation-progress { height:5px; background:#dfe9ed; overflow:hidden; }
.presentation-progress i { display:block; height:100%; background:linear-gradient(90deg,var(--cyan),#2f9e8f); transition:width .2s ease; }
.presentation-slide { overflow:auto; padding:24px 20px 30px; }
.presentation-slide .slide-count { display:inline-flex; color:var(--blue); background:var(--teal-soft); border-radius:999px; padding:7px 10px; font-size:.76rem; font-weight:800; }
.presentation-slide h2 { margin-top:16px; font-size:1.65rem; line-height:1.17; }
.presentation-slide .lesson-body { font-size:1rem; line-height:1.68; }
.presentation-actions { display:grid; grid-template-columns:1fr auto 1fr; gap:8px; padding:10px 12px max(10px,env(safe-area-inset-bottom)); border-top:1px solid var(--line); background:rgba(255,255,255,.97); }
.presentation-actions button { min-width:0; padding-left:10px; padding-right:10px; }
.presentation-outline { font-size:.78rem; }
.quiz-progress { display:flex; justify-content:space-between; align-items:center; color:var(--muted); font-size:.78rem; font-weight:750; }
.quiz-progress strong { color:var(--navy); }
.assessment-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:16px; }
.assessment-card { border:1px solid var(--line); background:white; border-radius:16px; padding:13px; min-height:124px; text-align:left; display:flex; flex-direction:column; color:var(--ink); }
.assessment-card>span { color:var(--blue); font-size:.72rem; font-weight:850; }
.assessment-card strong { color:var(--navy); margin-top:12px; }
.assessment-card small { color:var(--muted); line-height:1.35; margin-top:5px; }
.assessment-card em { margin-top:auto; padding-top:10px; color:var(--success); font-size:.75rem; font-style:normal; font-weight:800; }
.assessment-form { margin-top:14px; }
.wizard-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding-right:38px; margin-bottom:12px; }
.assessment-step-fields { display:grid; gap:12px; }
.assessment-step-fields .field { margin:0; }
.draft-note { display:flex; gap:7px; align-items:center; color:var(--success); font-size:.76rem; font-weight:750; margin-top:14px; }
.exercise-groups .list-row span { display:block; }
.exercise-media { margin-top:16px; min-height:150px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; padding:20px; border:1px dashed #9bb1bd; border-radius:18px; background:var(--soft); color:var(--blue); text-align:center; }
.exercise-media span { color:var(--muted); font-size:.78rem; line-height:1.4; max-width:320px; }
.exercise-detail-block { margin-top:18px; }
.exercise-detail-block p { color:var(--ink); line-height:1.55; margin:7px 0 0; }
.exercise-steps { margin:8px 0 0; padding-left:24px; color:var(--ink); line-height:1.55; }
.exercise-steps li+li { margin-top:8px; }
.field-help { display:block; margin-top:6px; color:var(--muted); font-size:.74rem; line-height:1.35; }
.formula-note { margin-top:13px; padding:11px 12px; border-radius:13px; background:var(--teal-soft); color:var(--blue); font-size:.8rem; font-weight:750; }
.assessment-result { display:flex; align-items:end; justify-content:space-between; gap:12px; margin-top:16px; padding:18px; border-radius:18px; background:linear-gradient(145deg,var(--navy),var(--blue)); color:white; }
.assessment-result strong { font-size:1.75rem; line-height:1.1; }
.assessment-result span { color:rgba(255,255,255,.72); font-size:.78rem; }
.sticky-actions { position:sticky; bottom:calc(-1 * max(20px,env(safe-area-inset-bottom))); z-index:3; margin:18px -2px 0; padding:12px 2px max(12px,env(safe-area-inset-bottom)); background:linear-gradient(180deg,rgba(255,255,255,.84),white 25%); }
.feature-list { display:grid; gap:9px; margin-top:16px; }
.feature-item { display:flex; gap:10px; align-items:flex-start; border:1px solid var(--line); background:white; border-radius:14px; padding:12px; }
.feature-item>span { width:25px; height:25px; flex:0 0 auto; display:grid; place-items:center; border-radius:8px; background:var(--teal-soft); color:var(--blue); }
.feature-item p { margin:2px 0 0; color:var(--ink); line-height:1.4; font-size:.9rem; }
.lesson-toolbar, .exam-head { display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:center; margin-bottom:15px; }
.lesson-toolbar span, .exam-head strong { text-align:center; color:var(--muted); font-size:.78rem; }
.lesson-toolbar button, .exam-head button { min-height:38px; padding:7px 12px; }
.lesson-body { margin-top:17px; color:var(--ink); font-size:.94rem; line-height:1.62; }
.lesson-body p { margin:0 0 15px; }
.lesson-body b { color:var(--navy); }
.exam-browser { background:white; border:1px solid var(--line); border-radius:18px; padding:15px; margin-top:12px; }
.certificate-card { margin-top:12px; border:2px solid #b5914f; outline:1px solid var(--navy); outline-offset:-7px; background:#faf8f3; padding:24px 20px; text-align:center; color:var(--navy); }
.certificate-card>span { font-size:.73rem; font-weight:850; letter-spacing:.13em; }
.certificate-card h3 { font-size:1.55rem; margin:13px 0 8px; }
.certificate-card p { color:var(--muted); line-height:1.35; }
.certificate-card strong, .certificate-card small { display:block; margin-top:13px; }
.certificate-card small { color:var(--muted); }
button:disabled { opacity:.45; cursor:not-allowed; }

@media (max-width: 820px) {
  html, body, .app-shell { height:var(--app-visible-height,100dvh); min-height:var(--app-visible-height,100dvh); overflow:hidden; }
  body { background:white; }
  .desktop-stage { display:block; height:var(--app-visible-height,100dvh); min-height:var(--app-visible-height,100dvh); padding:0; overflow:hidden; }
  .phone { max-width:none; height:100%; min-height:0; max-height:100%; border:0; border-radius:0; box-shadow:none; overflow:hidden; }
  .bottom-nav { position:relative; bottom:auto; left:auto; right:auto; flex:0 0 auto; width:100%; z-index:24; padding-bottom:calc(10px + max(env(safe-area-inset-bottom),var(--tg-content-safe-area-inset-bottom,0px))); box-shadow:0 -8px 24px rgba(16,42,67,.08); }
  .content { min-height:0; padding-bottom:24px; }
  .prototype-note { display:none; }
  .sheet-backdrop { padding:0; }
  .sheet { width:100%; max-height:calc(var(--app-visible-height,100dvh) - 56px); border-radius:24px 24px 0 0; padding-bottom:max(32px,calc(env(safe-area-inset-bottom) + 16px)); scroll-padding-bottom:96px; }
  .presentation { width:100%; }
}

@media (max-width: 380px) {
  .presentation-actions { grid-template-columns:1fr 1fr; }
  .presentation-outline { display:none; }
  .assessment-grid { grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce) { *, *:before, *:after { animation:none!important; transition:none!important; } }

/* Mobile immersive scroll: hide bottom navigation while the user scrolls down, restore on upward scroll. */
@media (max-width:820px){
 .bottom-nav{transition:transform .22s ease,opacity .18s ease;will-change:transform,opacity}
 .phone.nav-autohide .bottom-nav{transform:translateY(calc(100% + max(env(safe-area-inset-bottom),var(--tg-content-safe-area-inset-bottom,0px))));opacity:0;pointer-events:none}
 .content{transition:padding-bottom .22s ease}
 .phone.nav-autohide .content{padding-bottom:max(24px,env(safe-area-inset-bottom));}
}


/* Keep animated beacons in the artwork coordinate system on every screen. */
.recovery-path-visual{display:block;width:100%;height:58vh;overflow:hidden;filter:saturate(.95) contrast(.98)}
.launch-splash-visual .recovery-path-visual{height:100%}
.onboarding-visual .recovery-path-visual{animation:onboarding-drift 9s ease-in-out infinite alternate}
/* Animate the shapes themselves: visible rings and a travelling light on the path. */
.recovery-beacon-core{fill:#7ff0dc;transform-origin:0 0;animation:recovery-core-pulse 2s ease-out infinite;animation-delay:var(--beacon-delay)}
.recovery-beacon-halo{fill:#7ff0dc;fill-opacity:.16;stroke:#a5fff0;stroke-width:3;opacity:0;transform-origin:0 0;animation:recovery-halo-pulse 2s ease-out infinite;animation-delay:var(--beacon-delay)}
.recovery-wave{fill:none;stroke:#a5fff0;stroke-width:5;stroke-linecap:round;stroke-dasharray:18 100;stroke-dashoffset:18;opacity:0;animation:recovery-wave-travel 2s linear infinite}
@keyframes recovery-core-pulse{0%,25%,100%{opacity:.4;transform:scale(.9)}5%,10%{opacity:1;transform:scale(1.12)}}
@keyframes recovery-halo-pulse{0%{opacity:.85;transform:scale(1)}25%{opacity:0;transform:scale(3.1)}100%{opacity:0;transform:scale(3.1)}}
@keyframes recovery-wave-travel{0%{stroke-dashoffset:18;opacity:0}3%{opacity:1}25%{stroke-dashoffset:-100;opacity:1}28%,100%{stroke-dashoffset:-100;opacity:0}}
@media(prefers-reduced-motion:reduce){.onboarding-visual .recovery-path-visual,.recovery-beacon-core,.recovery-beacon-halo,.recovery-wave{animation:none}.recovery-beacon-halo,.recovery-wave{display:none}}

/* Compact assistant links: keep raw URLs out of the conversation flow. */
.ai-inline-link{display:inline-flex;align-items:center;max-width:100%;padding:2px 8px;margin:1px 2px;border:1px solid color-mix(in srgb,var(--accent,#2aa6a4) 34%,transparent);border-radius:999px;background:color-mix(in srgb,var(--accent,#2aa6a4) 10%,transparent);color:inherit;text-decoration:none;font-size:.92em;font-weight:650;line-height:1.5;vertical-align:baseline;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-inline-link:active{transform:translateY(1px)}
.ai-inline-link:focus-visible{outline:2px solid var(--accent,#2aa6a4);outline-offset:2px}


/* Patient diary core layout 2026-09-25 */
.patient-diary-core{display:grid;gap:14px}
.patient-diary-core>.page-head{margin-bottom:0}
.diary-picker-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0 0 2px}
.diary-picker-card{min-width:0;min-height:90px;padding:13px;border:1px solid var(--line);border-radius:18px;background:var(--card);color:var(--ink);display:grid;grid-template-columns:38px 1fr;align-items:center;gap:10px;text-align:left}
.diary-picker-card .icon-box{width:38px;height:38px;border-radius:13px;background:var(--teal-soft);display:grid;place-items:center;color:var(--blue)}
.diary-picker-card>span:last-child{min-width:0}
.diary-picker-card strong{display:block;color:inherit;font-size:.98rem;line-height:1.18;overflow-wrap:anywhere}
.diary-picker-card small{display:block;margin-top:4px;color:var(--muted);font-size:.76rem;line-height:1.25}
.diary-picker-card.active{background:var(--navy);color:#fff;border-color:var(--navy);box-shadow:0 8px 22px rgba(16,42,67,.12)}
.diary-picker-card.active .icon-box{background:rgba(255,255,255,.14);color:#fff}
.diary-picker-card.active small{color:rgba(255,255,255,.72)}
.diary-current{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:2px}
.diary-current h3{margin:0;color:var(--navy);font-size:1.22rem}
.diary-current p{margin:4px 0 0;color:var(--muted);line-height:1.35}
.diary-period-card{display:grid;gap:12px;margin:0}
.diary-period-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.diary-period-head h3{margin:0}.diary-period-head small{color:var(--muted);text-align:right}
.diary-range-chips{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.diary-range-chips button{min-width:0;padding:10px 6px;min-height:44px}
.diary-custom-period{border-top:1px solid var(--line);padding-top:4px}
.diary-custom-period>summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:750;color:var(--blue)}
.diary-custom-period form{display:grid;gap:10px;padding-top:8px}
.diary-custom-period .control-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.diary-report-bar{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.diary-report-bar button{min-width:0;min-height:50px}
.patient-diary-core .diary-insight-card{margin:0}
.patient-diary-core .card:has(.diary-chart-motion){margin:0}
.diary-chart-empty{text-align:center;padding:24px;margin:0}
.diary-chart-empty .icon-box{margin:0 auto 10px}
.diary-records-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:4px}
.diary-records-title h3{margin:0}.diary-records-title small{color:var(--muted)}
.patient-diary-core .record-card{margin:0}
@media(max-width:390px){
 .diary-picker-card{padding:11px;grid-template-columns:34px 1fr}
 .diary-picker-card .icon-box{width:34px;height:34px}
 .diary-range-chips{grid-template-columns:repeat(2,minmax(0,1fr))}
 .diary-report-bar{grid-template-columns:1fr}
 .diary-custom-period .control-row{grid-template-columns:1fr}
}


/* Patient diary report dialog 2026-09-25 */
.diary-report-bottom{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}
.diary-report-dialog{width:min(94vw,620px);max-height:88dvh;padding:0;border:1px solid var(--line);border-radius:24px;background:var(--card);color:var(--ink);overflow:hidden}
.diary-report-dialog::backdrop{background:rgba(16,42,67,.48)}
.diary-report-dialog>form{display:grid;gap:14px;padding:18px}
.diary-report-dialog header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.diary-report-dialog header h3{margin:2px 0 0;color:var(--navy)}
.diary-report-dialog header small{display:block;color:var(--muted)}
.diary-report-dialog [data-report-close]{min-width:44px;min-height:44px}
.diary-report-periods{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.diary-report-periods button{min-width:0;min-height:44px;padding:10px 6px}
.diary-report-dialog .control-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.diary-report-dialog [role=status]{min-height:1.2em;margin:0;color:var(--muted)}
@media(max-width:390px){
 .diary-report-periods{grid-template-columns:repeat(2,minmax(0,1fr))}
 .diary-report-dialog .control-row{grid-template-columns:1fr}
}
