/* Phones and tablets. Loaded last, so these rules settle the small-screen layout for every role. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
/* iOS zooms the page when a field under 16px takes focus; on touch screens every field is 16px. */
@media (pointer:coarse),(max-width:1100px){input,select,textarea,.composer select{font-size:16px}}
/* The bottom tabs take their own space (with the home indicator), so they never cover the message box. */
@media (max-width:1100px){
 .shell.staff .main,.shell.staff .advisor,.shell.patient .main,.shell.patient .advisor{padding-bottom:calc(57px + env(safe-area-inset-bottom))}
 .shell.staff.show-advisor .advisor{inset:0 0 calc(57px + env(safe-area-inset-bottom)) 0;padding-bottom:0}
 .board{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
 /* While typing, the tabs step aside so the page does not shift around the keyboard. */
 body.typing .tabs{display:none}
}
@media (max-width:760px){
 /* Staff on a phone: one column; the list slides in from the left, the advisor is a tab. */
 .shell.staff{grid-template-columns:1fr}
 .main>header{padding-top:calc(12px + env(safe-area-inset-top))}
 .titleblock h1{font-size:19px;line-height:1.35}
 #drawer{width:100vw}
 dialog{width:calc(100vw - 16px);max-height:calc(100dvh - 24px);padding:18px}
 /* “建议这样回答” opens as a half sheet from the bottom. */
 dialog.sheet{width:100vw;max-width:100vw;max-height:72dvh;margin:auto 0 0;padding-bottom:calc(18px + env(safe-area-inset-bottom));border-radius:var(--r-sheet) var(--r-sheet) 0 0}
 /* Notices sit to the right of the list button and show the newest one, with how many more are waiting. */
 #alerts{left:64px;right:8px;top:calc(60px + env(safe-area-inset-top));width:auto}
 #alerts .alert{display:none;padding:8px 10px}
 #alerts .alert:last-child{display:block}
 #alerts .alert[data-more]::after{content:"还有 " attr(data-more) " 条提醒";display:block;font-size:12px;color:var(--c-muted);margin-top:4px}
 .board{padding:12px 12px calc(76px + env(safe-area-inset-bottom))}
 .board-head{gap:8px}.board-head h1{font-size:24px}
 .kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.kpi{padding:10px 12px}.kpi b{font-size:28px}
 .charts{grid-template-columns:1fr}
 .director{padding:14px 12px 40px}
 /* Dashboard events: one line of text, the duration and the summary button beside it. */
 .events li{display:block;padding:6px 0;border-bottom:1px solid var(--c-line)}.events li button{float:right;margin:0 0 4px 8px}
 /* Tables keep their labels on one line and scroll sideways inside their frame. */
 .board th,.board td:first-child{white-space:nowrap}.board th button{font-size:12px;padding:4px 10px;min-height:44px;margin-left:4px}
}
