/* DAS 11.2: final layout rules, shared by public pages and administration.
   Loaded last so decorative theme layers cannot reset responsive geometry. */
:root{--header-height:78px;--mobile-nav-space:calc(82px + env(safe-area-inset-bottom))}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
[hidden]{display:none!important}
.section.section-tight{padding-top:18px}
:where(.grid,.form-grid,.hero-grid,.case-data-grid,.case-detail-layout,.profile-dashboard-grid,.attendance-grid,.admin-section-stack)>*{min-width:0}
:where(.form-group,.admin-form,.admin-edit,.admin-edit-pop,.news-rich-editor,.campus-workspace>div,.campus-workspace form){min-width:0}
:where(.btn,.answer-btn){white-space:normal;overflow-wrap:anywhere;text-align:center}
.answer-btn{text-align:left}
:where(.avatar,.brand-mark,.icon-btn,.attendance-avatar,.admin-plus){flex-shrink:0}
.profile-pill{position:relative}
.topbar .brand-text{max-width:130px}
.footer .brand,.mobile-menu-head .brand{max-width:none}
.home-strip-grid{position:relative}
.grid>.empty:only-child{grid-column:1/-1}
:where(.news-article-content,.event-content,.case-clinical,.news-editor-surface){overflow-wrap:anywhere}
:where(.news-article-content,.event-content) :where(img,video){height:auto;max-width:100%}
:where(.news-article-content,.event-content) iframe{width:100%;max-width:100%;aspect-ratio:16/9;height:auto}
:where(.news-article-content,.event-content) pre{max-width:100%;overflow-x:auto}
.card.article-cover{padding:0}
.event-layout{align-items:start}
.event-cover{height:auto;align-self:start}
.event-layout-no-cover .event-sidebar{grid-column:2;grid-row:1}
.event-layout-no-cover .event-content{grid-column:1;grid-row:1}
.event-sidebar .event-qr-card{grid-template-columns:minmax(0,1fr);text-align:center;gap:12px}
.event-sidebar .event-qr{width:min(180px,100%);min-width:0;margin-inline:auto}
.event-sidebar .event-qr-copy .attendance-badge{justify-content:center;text-align:center}
.profile-dashboard-hero{align-items:start}
.profile-level-card{align-self:center}
.rank-card .rank-num{display:inline-grid;place-items:center;min-width:60px;min-height:52px;padding:5px 12px;border-radius:16px;margin-bottom:12px}
.top-three{align-items:stretch}
.rank-card.first{padding-top:28px}
/* Menus and search must remain above the chat header and both navigation bars. */
.mobile-menu{z-index:200}
.search-modal{z-index:210;overflow-y:auto;overscroll-behavior:contain}
.search-panel{max-height:100%;display:flex;flex-direction:column;min-height:0}
.search-head{flex-shrink:0}
.search-head .input{min-width:0}
.search-head .icon-btn{flex-shrink:0}
.search-results{min-height:0;overscroll-behavior:contain}
.toast-root{z-index:220;max-width:calc(100vw - 32px)}
.toast{overflow-wrap:anywhere}
.mobile-menu-panel{overscroll-behavior:contain}
.mobile-menu-head,.mobile-user-card,.mobile-account-actions{flex-shrink:0}
.mobile-user-card>div{min-width:0}
/* One bounded chat viewport: only contacts/messages scroll, never the document. */
body.chat-page{display:flex;flex-direction:column;height:var(--chat-vh,100dvh);min-height:0;overflow:hidden!important;padding:0!important}
.chat-page .topbar{position:relative!important;inset:auto!important;flex:0 0 auto;z-index:60}
.chat-page main{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;height:auto!important;padding:0!important;overflow:hidden!important}
.chat-page #spa-page{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;height:auto!important;overflow:hidden}
.chat-page .chat-page-head{flex:0 0 auto;padding:14px 0 10px}
.chat-page .chat-page-head h1{margin:5px 0;font-size:28px}
.chat-page .chat-page-head p{margin:5px 0}
.chat-page .section.section-tight{flex:1 1 auto;min-height:0;height:auto!important;padding:10px 0 18px!important}
.chat-page .section-tight>.container{height:100%;min-height:0}
.chat-page .chat-shell{height:100%!important;min-height:0!important;max-height:none!important;grid-template-columns:clamp(260px,27vw,340px) minmax(0,1fr)!important}
.chat-page .chat-messages{scroll-behavior:auto}
.chat-page .chat-bubble-row{flex-shrink:0}
.chat-page .chat-composer textarea{font-family:inherit;line-height:1.45}
.chat-page .chat-send-btn{flex-shrink:0}
.chat-page .pwa-install,.chat-page .pwa-ios-help{display:none!important}
/* Preserve the conversation and composer on landscape/short laptop screens. */
@media(min-width:821px) and (max-height:600px){
 .chat-page .chat-page-head{display:none}
 .chat-page .section.section-tight{padding-block:10px!important}
}
/* Admin forms use the available column, including expanded inline editors. */
.admin-top{flex-direction:row;align-items:flex-start}
.admin-top>div:first-child{min-width:0;flex:1}
.admin-top-actions{flex:0 0 auto;width:auto;max-width:none}
.admin-breadcrumb{flex-wrap:wrap}
.admin-card-actions{min-width:0;flex-wrap:wrap}
.admin-edit-inline[open]{flex-basis:100%;width:100%;max-width:100%}
.admin-edit-pop,.event-edit-pop{max-width:100%;min-width:0}
.admin-form input[type=file]{width:100%;min-width:0}
.admin-form label:has(>input[type=checkbox]),.check-card{overflow-wrap:anywhere}
.campus-workspace form{flex:0 1 560px}
.campus-workspace label{flex-shrink:0}
.campus-workspace select{min-width:0;flex:1}
.campus-workspace .btn{flex-shrink:0}
.admin-body .admin-side-brand .brand{max-width:none}
.admin-event-tabs a{flex-shrink:0}
.event-participants-search .admin-search-main{min-width:0}
.event-participants-table,.table-wrap,.compact-table{min-width:0}
.news-editor-toolbar button{flex-shrink:0}
@media(max-width:1280px){
 .desktop-nav{display:none}.mobile-menu-btn{display:grid}
 .topbar .brand{max-width:none;flex:1;min-width:0}
 .nav-actions{margin-left:0}
}
/* Six primary links remain visible on laptop/desktop widths. Other sections
   are available through the same menu button at every viewport size. */
.topbar .mobile-menu-btn{display:grid}
@media(min-width:1024px){
 .topbar .nav-wrap{gap:14px;height:78px}
 .topbar .brand{flex:0 1 180px;max-width:180px;gap:8px}
 .topbar .brand-logo{max-width:80px}
 .topbar .brand-text{min-width:0}
 .topbar .desktop-nav{display:flex;flex:0 0 auto;gap:2px;margin-inline:auto}
 .topbar .desktop-nav a{font-size:13px;padding:10px 9px;white-space:nowrap}
 .topbar .nav-actions{margin-left:0;gap:6px}
 .topbar .profile-pill .hide-mobile{max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
@media(min-width:1024px) and (max-width:1199px){
 .topbar .nav-wrap{gap:10px}
 .topbar .brand{flex-basis:145px;max-width:145px}
 .topbar .brand-logo{max-width:60px}
 .topbar .brand-text{font-size:13px}
 .topbar .desktop-nav a{font-size:12px;padding-inline:7px}
 .topbar .nav-actions{gap:4px}
 .topbar .nav-actions .icon-btn{width:38px;height:40px}
 .topbar .profile-pill{padding:3px;gap:0}
 .topbar .profile-pill .hide-mobile{display:none}
 .topbar .profile-pill .badge{position:absolute;right:-4px;top:-4px;margin:0}
 .topbar .nav-actions>.btn{font-size:12px;padding-inline:10px}
}
@media(max-width:1100px){
 .campus-workspace{align-items:flex-start;flex-direction:column;gap:16px}
 .campus-workspace form{flex:auto;width:100%;flex-wrap:wrap}
}
@media(max-width:900px){
 .admin-top{flex-direction:row;align-items:flex-start;gap:12px}
 .admin-top-actions{padding:0}
 .admin-top-actions .icon-btn{width:42px;height:42px;min-height:42px}
 .admin-side .brand{max-width:none}
}
@media(max-width:820px){
 :root{--header-height:64px}
 body:not(.admin-body):not(.chat-page){padding-bottom:var(--mobile-nav-space)}
 .section.section-tight{padding-top:16px}
 .topbar .nav-wrap{height:var(--header-height);min-height:var(--header-height)}
 .topbar .brand{gap:7px;overflow:hidden;min-width:0}
 .topbar .brand-mark{width:34px;height:34px;flex-basis:34px}
 .topbar .brand-text{display:block;font-size:12px;max-width:none}
 .nav-actions .icon-btn{width:40px;height:40px;min-width:40px}
 .topbar .brand-logo{max-width:64px;height:32px}
 .footer .brand-text{display:block}
 .bottom-nav{bottom:max(6px,env(safe-area-inset-bottom))}
 .event-layout-no-cover .event-sidebar,.event-layout-no-cover .event-content{grid-column:1;grid-row:auto}
 .chat-page main{padding-bottom:var(--mobile-nav-space)!important}
 .chat-page .section.section-tight{padding:0!important}
 .chat-page .chat-shell{border-radius:0!important}
 .chat-page.chat-keyboard-open main{padding-bottom:0!important}
 .chat-page.chat-keyboard-open .bottom-nav{display:none!important}
 .chat-page .chat-conversation-head{grid-template-columns:40px 40px minmax(0,1fr)!important}
 .chat-page .chat-conversation-head .avatar{width:40px!important;height:40px!important}
 .chat-page .chat-composer textarea{max-height:min(100px,25dvh)!important}
 .chat-page .chat-composer{padding-bottom:max(9px,env(safe-area-inset-bottom))!important}
 .chat-page .chat-send-btn{color:#fff;background:#6244d9}
 .section-head{align-items:flex-start}
 .auth-shell{min-height:calc(100dvh - var(--header-height) - var(--mobile-nav-space))}
 .attendance-profile-card{align-items:flex-start}
}
@media(max-width:620px){
 .hero-actions{grid-template-columns:minmax(0,1fr)}
 .hero-actions .btn{font-size:14px;min-height:48px}
 .hero-trust{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
 .hero-trust span{padding:10px 8px;font-size:11px}
 .hero-trust b{font-size:12px}
 .profile-dashboard-hero{grid-template-columns:54px minmax(0,1fr);align-items:start}
 .profile-identity h1{font-size:clamp(22px,6vw,28px)}
 .profile-summary-line{font-size:12px;line-height:1.5}
 .profile-actions{display:flex;flex-wrap:wrap}
 .profile-actions .btn{width:auto;flex:1 1 90px;min-height:42px;font-size:12px}
 .rating-table-wrap th:first-child,.rating-table-wrap td:first-child{width:40px}
 .rating-table-wrap th:nth-child(4),.rating-table-wrap td:nth-child(4){width:76px;white-space:nowrap}
 .rating-user-cell{min-width:0;gap:8px}
 .rating-user-cell b{white-space:normal;overflow-wrap:anywhere;line-height:1.35}
 .rating-user-cell small{font-size:11px}
 .rating-table-avatar{flex-shrink:0}
 .rating-table-wrap .empty{white-space:normal!important}
 .rank-card{padding-block:22px}.rank-card.first{padding-top:22px}
 .attendance-profile-card{gap:12px;padding:16px}
 .attendance-avatar{width:48px;height:48px;flex-basis:48px;font-size:23px;border-radius:15px}
 .attendance-person h2{font-size:22px;margin-top:0}
 .campus-workspace form{display:grid;grid-template-columns:minmax(0,1fr);gap:9px}
 .campus-workspace form .btn{width:100%}
 .campus-workspace{padding:16px}
 .admin-section-kicker{align-items:flex-start;flex-wrap:wrap}
 .admin-panel>summary>span:first-child{min-width:0}
 .admin-panel>summary>.chip{flex-shrink:0;white-space:nowrap}
 .admin-panel[open]>summary{padding-bottom:16px;margin-bottom:16px}
 .admin-body .event-absence-reason-form{min-width:0}
 .admin-savebar{position:static;margin-top:18px}
 .profile-settings-dialog .avatar-editor{grid-template-columns:minmax(0,1fr)}
 .profile-dialog-head{align-items:center}
 .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .pwa-install{align-items:stretch;flex-wrap:wrap;gap:10px}
 .pwa-install>div{flex:1 1 180px;min-width:0}
 .pwa-install .btn{flex:1 1 100%;width:100%}
}
@media(max-width:380px){
 .topbar .nav-wrap{gap:4px}.nav-actions{gap:0}
 .nav-actions .icon-btn{width:38px;min-width:38px;height:40px}
 .topbar .brand-text{font-size:11px}
 .topbar .brand-logo{max-width:46px}
 .hero-trust{grid-template-columns:minmax(0,1fr)}
 .profile-dashboard-hero{grid-template-columns:minmax(0,1fr)}
 .profile-level-card{width:100%}
 .rating-user-cell{gap:6px}
 .rating-table-avatar{display:none!important}
}
@media(prefers-reduced-motion:reduce){.card:hover,.btn:hover{transform:none}}
