/* Mobile overrides only; desktop geometry stays in its existing stylesheets. */
.mobile-menu-toggle,.mobile-menu-close,.mobile-nav-backdrop{display:none}
@media(max-width:720px){
 html{scroll-padding-top:12px}body{min-width:0}input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px!important;max-width:100%;min-width:0}button,.btn{touch-action:manipulation}.btn{min-height:44px}a,button{ -webkit-tap-highlight-color:transparent }
 html.embedded .app-main,.app-main{padding:16px 12px 28px;min-width:0}.app-main h1{font-size:24px;overflow-wrap:anywhere}.panel{max-width:100%;overflow-x:auto}.app-topbar{flex-wrap:wrap;gap:10px}.app-topbar .brand{min-width:0}.app-topbar .app-user{flex-wrap:wrap}
 body:has(.layout){padding:0;height:100dvh;min-height:0;overflow:hidden}.layout{display:flex;height:100vh;height:100dvh;border:0;border-radius:0}.layout>.content-area{height:100%;min-height:0;flex:1}.layout .workspace-stage{flex:1;min-height:0;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}.layout .content-frame{height:100%;min-height:0}.layout .main-content{padding:18px 12px 32px;min-width:0}
 .layout>.sidebar{position:fixed;inset:0 auto 0 0;width:min(320px,88vw);height:100vh;height:100dvh;max-height:none;padding:16px;display:flex;z-index:302;transform:translateX(-105%);visibility:hidden;transition:transform .2s,visibility .2s;background:#edf4fa;border-right:1px solid #b7cddd;box-shadow:10px 0 35px #18315333;overscroll-behavior:contain}.mobile-nav-open .layout>.sidebar{transform:none;visibility:visible}.layout .sidebar nav{display:flex;flex-direction:column;gap:4px}.layout .sidebar nav a{min-height:44px;font-size:16px;padding:10px}.layout .sidebar nav .nav-child{min-height:42px;font-size:15px}.layout .sidebar .nav-label{font-size:12px}.layout .sidebar-footer{display:block;padding-bottom:env(safe-area-inset-bottom)}.layout .sidebar-footer a{padding:8px 0;min-height:40px}.layout .sidebar-brand{padding-right:36px}
 .mobile-menu-toggle,.mobile-menu-close{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;border:1px solid #c7d9e8;border-radius:11px;background:#f4f9fd;color:#24587d;font:inherit;cursor:pointer;flex-shrink:0}.mobile-menu-close{position:absolute;right:14px;top:14px;z-index:3;font-size:24px}.mobile-nav-backdrop:not([hidden]){display:block;position:fixed;inset:0;border:0;background:#142d4966;backdrop-filter:blur(2px);z-index:301;width:100%;height:100%}
 .layout .global-topbar{padding:8px 12px;gap:8px;min-height:0;height:auto;display:flex;flex-wrap:wrap}.layout .topbar-actions{margin-left:auto;gap:6px;min-width:0}.layout .period-pill{min-height:40px;font-size:12px;padding:4px 7px}.layout .user-pill{padding:4px;border:0;background:transparent}.layout .user-pill>span:not(.top-avatar){display:none}.layout .user-pill .top-avatar{display:grid;flex-shrink:0}.layout .global-search{order:3;flex:1 1 100%;max-width:none;margin:0}.layout .global-search input{height:42px}.layout .global-search-results{max-height:55dvh}.layout .section-head,.layout .dashboard-head{flex-direction:column;align-items:stretch;gap:10px}.layout .dashboard-head>div{min-width:0}.layout .department-grid,.layout .snapshot-grid,.layout .budget-summary-grid,.layout .budget-department-grid{grid-template-columns:minmax(0,1fr)}.layout .overview-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.layout .overview-card{padding:14px 12px}.layout .overview-number{font-size:27px}.layout .overview-label{font-size:14px}.layout .budget-department-totals{gap:8px;grid-template-columns:1fr}.layout .budget-department-total{display:flex;justify-content:space-between;gap:10px}.layout .budget-department-total strong{white-space:normal;overflow-wrap:anywhere;font-size:16px}.layout .project-budget-row{grid-template-columns:1fr}.layout .project-budget-values{text-align:left;white-space:normal}.layout .project-budget-sub{white-space:normal}.layout .quick-actions .btn{flex:1 1 140px}.layout .snapshot-card{padding:16px}.layout .alert-item{flex-wrap:wrap}.layout .updated-at{text-align:left}
 .allocation-chart{padding:16px 12px;min-width:0}.allocation-chart h3{font-size:19px;line-height:1.5}.ac-layout{flex-direction:column;gap:16px}.ac-pie{width:min(190px,75vw)}.ac-table{width:100%;max-height:360px;overflow-y:auto}.ac-table table,.ac-table tbody{display:block}.ac-table thead{display:none}.ac-table tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;padding:12px 2px;border-bottom:1px solid #e0eaf2}.ac-table td{padding:0;border:0;min-width:0!important;white-space:normal!important}.ac-table td:first-child{grid-column:1/-1}.ac-table td:nth-child(2){text-align:left;font-size:15px}.ac-table td:nth-child(2)::before{content:'งบที่ได้รับ ';color:#657c90;font-size:13px}.ac-table td:nth-child(3){text-align:right;font-size:15px}.ac-table td:nth-child(3)::before{content:'สัดส่วน ';color:#657c90;font-size:13px}.ac-caption{line-height:1.65}
 .wf-projects>.wf-project{grid-template-columns:minmax(0,1fr);padding:16px 12px;gap:12px}.wf-project h3{overflow-wrap:anywhere}.wf-project-summary .wf-balances{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.wf-project-summary .wf-balances div{padding:11px 9px}.wf-project-summary .wf-balances strong{font-size:19px;overflow-wrap:anywhere}.wf-project-controls{display:block}.wf-project-controls .wf-actions{margin-top:12px;justify-content:flex-start}.wf-actions .btn{flex:1 1 130px;min-height:44px}.wf-grid{grid-template-columns:minmax(0,1fr)}.wf-wide{grid-column:auto}.wf-item-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.wf-item-grid label:first-child{grid-column:1/-1}.wf-tools input{max-width:none;width:100%}.wf-notice--alert{flex-direction:column;align-items:flex-start}.wf-notice--alert .btn{margin-left:0}.wf-project-controls .wf-allocation{margin-top:12px;flex-wrap:wrap}.wf-allocation label{flex-basis:100%}.wf-allocation .btn{width:100%}.wf-line-items{max-width:100%;overflow-x:auto}.wf-detail-table{min-width:480px}.wf-owner-choices{grid-template-columns:1fr}.wf-funding{grid-template-columns:minmax(0,1fr)}.wf-funding-row{font-size:16px;flex-wrap:wrap}
 .wf-modal,.pb-dialog,.ak-dialog{max-height:90vh;max-height:90dvh;width:calc(100% - 20px);padding:16px 12px}.wf-modal .wf-actions,.pb-actions,.ak-footer{gap:8px}.wf-modal .wf-actions .btn,.pb-actions .btn{flex:1 1 130px;white-space:normal}.ak-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}.ak-toolbar label{grid-column:1/-1;min-width:0}.ak-toolbar button{justify-content:center;min-height:44px}.ak-row{flex-wrap:wrap}.ak-row b{margin-left:30px}.ak-impact{grid-template-columns:1fr}.ak-footer button{min-height:44px}.ak-footer>span{flex-basis:100%}.ak-title h2{font-size:22px}.ak-title .ak-skull{font-size:36px}.ak-dialog .ak-selection-summary{font-size:13px}
 .page .hero,.page .head{align-items:stretch;flex-direction:column}.page .hero .actions{width:100%}.page .hero .actions>*{flex:1;min-width:0}.page .toolbar{flex-direction:column}.page .toolbar input,.page .toolbar select{width:100%;min-width:0}.page .grid,.page .roles{grid-template-columns:minmax(0,1fr)}.page .summary{grid-template-columns:repeat(2,minmax(0,1fr))}.page .view{padding:14px 10px}.page .metric{padding:12px}.page .metric strong{overflow-wrap:anywhere;font-size:19px}.page .modal{padding:18px 12px;max-height:90dvh}.page .audit{grid-template-columns:1fr}.page .modal-actions{flex-wrap:wrap}.page .modal-actions .btn{flex:1 1 120px}.page .projects{grid-template-columns:minmax(0,1fr)}
 .expense-form-grid{grid-template-columns:1fr}.expense-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.expense-summary-card strong{white-space:normal;overflow-wrap:anywhere}.project-actions{flex-wrap:wrap}.project-actions .btn{flex:1 1 120px}.expense-modal-head{flex-wrap:wrap}.expense-modal-body{max-height:75dvh}.project-card{min-width:0}.project-name{overflow-wrap:anywhere}
}
@media(max-width:650px){.ak-hero-panel{padding:165px 18px 22px;background-size:100% 190px,auto 190px;background-image:linear-gradient(180deg,transparent 55px,#071b17 180px),url('/images/avada-duel-hero.webp')}.ak-hero-content{gap:12px}.ak-hero-panel .ak-image-button{width:min(100%,360px)}.ak-hero-panel .ak-admin-hint{font-size:15px}.sn-panel{top:116px;max-height:calc(100dvh - 130px)}.sn-list{max-height:calc(100dvh - 215px)}}
@media(prefers-reduced-motion:reduce){.mobile-nav-open .layout>.sidebar{transition:none}}
/* ===== โครงหลักบนมือถือ: แถบบนแถวเดียว + แถบเมนูล่าง ===== */
.mobile-tabbar,.ms-picker{display:none}
@media(max-width:720px){
 .layout .global-topbar{flex-wrap:nowrap;align-items:center;padding:8px 10px;padding-top:max(8px,env(safe-area-inset-top));gap:8px;border-bottom:1px solid #dbe6ef;background:rgba(246,250,253,.96)}
 .layout .global-search{order:0;flex:1 1 auto;min-width:0}
 .layout .global-search input{height:42px;border-radius:12px}
 .layout .topbar-actions{flex:0 0 auto;margin-left:0}
 .layout .topbar-actions>:not(#schoolNotifications):not(.theme-toggle){display:none!important}
 .layout #schoolNotifications .sn-toggle,.layout .mobile-menu-toggle{display:none}
 .layout .sn-panel{position:fixed;top:auto;bottom:calc(66px + env(safe-area-inset-bottom));left:8px;right:8px;width:auto;max-height:calc(100dvh - 150px)}
 .layout .sn-list{max-height:calc(100dvh - 230px)}
 .layout>.content-area{padding-bottom:calc(60px + env(safe-area-inset-bottom))}
 .mobile-tabbar{display:grid;grid-template-columns:repeat(auto-fit,minmax(0,1fr));position:fixed;left:0;right:0;bottom:0;z-index:300;background:rgba(255,255,255,.97);border-top:1px solid #d6e2ec;box-shadow:0 -6px 20px rgba(30,60,90,.08);padding:4px 4px env(safe-area-inset-bottom);backdrop-filter:blur(12px)}
 .mobile-tabbar button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:56px;border:0;background:none;color:#5d7387;font:inherit;font-size:11.5px;cursor:pointer;border-radius:12px}
 .mobile-tabbar button[hidden]{display:none}
 .mobile-tabbar button.active{color:#1E5FC0}.mobile-tabbar button.active svg{stroke-width:2.3}
 .mobile-tabbar button:active{background:#eef4fa}
 .mobile-tabbar .mt-badge{position:absolute;top:5px;left:calc(50% + 4px);min-width:18px;height:18px;padding:0 5px;border-radius:99px;background:#e0423b;color:#fff;font-size:11px;line-height:18px;font-weight:700}
 .mobile-tabbar .mt-badge[hidden]{display:none}
 .mobile-tabbar .mt-dot{position:absolute;top:8px;left:calc(50% + 8px);width:9px;height:9px;border-radius:50%;background:#e5383b;box-shadow:0 0 0 2px #fff;pointer-events:none}
 .mobile-nav-open .mobile-tabbar{z-index:303}
 .layout>.sidebar{padding-bottom:calc(76px + env(safe-area-inset-bottom));overflow-y:auto}
 .layout .sidebar nav a.nav-grades,.layout .sidebar nav a[class*="nav-"][target]{min-height:46px}
}
/* ===== สไตล์กลางบนมือถือ (ทุกหน้า รวมหน้าใน iframe) ===== */
@media(max-width:720px){
 body{-webkit-text-size-adjust:100%;text-size-adjust:100%}
 img,video,iframe{max-width:100%}
 h1{font-size:22px;line-height:1.35}h2{font-size:18px;line-height:1.4}
 .btn,button.btn,a.btn{min-height:44px;padding-left:14px;padding-right:14px;border-radius:12px}
 select,input:not([type=checkbox]):not([type=radio]):not([type=range]){min-height:44px}
 input[type=checkbox],input[type=radio]{width:20px;height:20px}
 textarea{min-height:96px}
 label{line-height:1.45}
 table{font-size:14px}
 th,td{padding:9px 10px}
 .table-wrap,.tw-table,.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
 [role=tablist],.tabs,.dash-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
 [role=tablist]::-webkit-scrollbar,.tabs::-webkit-scrollbar,.dash-tabs::-webkit-scrollbar{display:none}
 [role=tablist]>*,.tabs>*,.dash-tabs>*{flex:0 0 auto}
 dialog{max-width:calc(100vw - 16px);max-height:calc(100dvh - 24px);overflow:auto;border-radius:18px}
 .modal,.modal-panel{width:calc(100vw - 16px)!important;max-width:none!important;max-height:calc(100dvh - 24px);overflow:auto}
 .tw-page{padding:14px 12px 28px}.tw-head{flex-direction:column;align-items:stretch}.tw-actions{width:100%}.tw-actions>*{flex:1 1 auto}.tw-term select{min-width:0;width:100%}
 .tw-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.tw-card{padding:11px 12px}.tw-card strong{font-size:19px}
 .tw-grid,.tr-grid{grid-template-columns:minmax(0,1fr)}
}
/* แถบเมนูล่าง: สูงขึ้น เว้นขอบ iPhone และลูกเล่นเมื่อกด */
@media(max-width:720px){
 .layout>.content-area{padding-bottom:calc(74px + env(safe-area-inset-bottom))}
 .mobile-tabbar{padding:6px 8px calc(8px + env(safe-area-inset-bottom));gap:4px}
 .mobile-tabbar button{min-height:62px;font-size:12px;gap:3px;transition:color .2s}
 .mobile-tabbar button::before{content:'';position:absolute;inset:4px 10%;border-radius:16px;background:#e5effb;transform:scale(.6);opacity:0;transition:transform .25s cubic-bezier(.34,1.56,.64,1),opacity .2s}
 .mobile-tabbar button.active::before{transform:scale(1);opacity:1}
 .mobile-tabbar button>*{position:relative}
 .mobile-tabbar button svg{transition:transform .25s cubic-bezier(.34,1.56,.64,1)}
 .mobile-tabbar button.active svg{transform:translateY(-1px) scale(1.08)}
 .mobile-tabbar button:active{background:none}
 .mobile-tabbar button:active svg{transform:scale(.82)}
 .mobile-tabbar button.pop svg{animation:mt-pop .42s cubic-bezier(.34,1.56,.64,1)}
 .mobile-tabbar button.pop::after{content:'';position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-28px 0 0 -22px;border-radius:50%;background:rgba(30,95,192,.18);animation:mt-ripple .5s ease-out forwards;pointer-events:none}
 .mobile-tabbar .mt-badge{top:7px;transition:transform .2s}
 .mobile-tabbar button.pop .mt-badge{animation:mt-pop .42s}
 .layout .sn-panel{bottom:calc(84px + env(safe-area-inset-bottom))}
 .layout>.sidebar{padding-bottom:calc(92px + env(safe-area-inset-bottom))}
}
@keyframes mt-pop{0%{transform:scale(1)}35%{transform:scale(.78)}70%{transform:scale(1.18) translateY(-2px)}100%{transform:scale(1.08) translateY(-1px)}}
@keyframes mt-ripple{from{transform:scale(.3);opacity:1}to{transform:scale(2.2);opacity:0}}
@media(prefers-reduced-motion:reduce){.mobile-tabbar button svg,.mobile-tabbar button::before{transition:none}.mobile-tabbar button.pop svg,.mobile-tabbar button.pop::after{animation:none}}
/* แจ้งเตือนบนมือถือ (ย้ายไปไว้ที่ body) */
@media(max-width:720px){
 .school-notifications.sn-mobile{position:static}
 .sn-mobile .sn-toggle{display:none!important}
 .sn-mobile .sn-panel{position:fixed;top:auto;left:8px;right:8px;bottom:calc(84px + env(safe-area-inset-bottom));width:auto;max-height:calc(100dvh - 170px);z-index:1001;border-radius:18px;animation:sn-up .22s ease-out}
 .sn-mobile .sn-list{max-height:calc(100dvh - 250px);overflow-y:auto}
}
@keyframes sn-up{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
/* ===== กันหน้าเลื่อนซ้ายขวาบนมือถือ (ทุกหน้า) ===== */
@media(max-width:720px){
 html,body{max-width:100%;overflow-x:clip}
 @supports not (overflow:clip){html,body{overflow-x:hidden}}
 main,section,article,aside,header,footer,form,fieldset,.panel,.card,[class*="card"],[class*="grid"]>*,[class*="-row"]>*{min-width:0}
 img,video,canvas,svg,iframe,embed,object{max-width:100%}
 img,video,canvas{height:auto}
 pre,code{white-space:pre-wrap;overflow-wrap:anywhere}
 p,li,dd,dt,h1,h2,h3,h4,label,strong,small{overflow-wrap:anywhere}
 .mfit-scroll{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:12px}
 input,select,textarea{max-width:100%}
}
/* Keep all six shortcuts tappable without wrapping labels on narrow phones. */
@media(max-width:720px){
 .mobile-tabbar button{min-width:0;padding-inline:0}
 .mobile-tabbar button>span{white-space:nowrap}
}
@media(max-width:360px){
 .mobile-tabbar{gap:0;padding-left:4px;padding-right:4px}
 .mobile-tabbar button{font-size:11px}
}
/* The chat rises inside the school app; the navigation bar stays outside the frame. */
.mobile-chat-panel{display:none}
@media(max-width:720px){
 .mobile-chat-open{overflow:hidden}
 .mobile-chat-panel{display:flex;flex-direction:column;position:fixed;left:0;right:0;top:0;height:calc(100dvh - 84px - env(safe-area-inset-bottom));padding-top:env(safe-area-inset-top);z-index:299;overflow:hidden;border-radius:20px 20px 0 0;background:#fff;box-shadow:0 -12px 45px #1831531c;transform:translateY(105%);visibility:hidden;pointer-events:none;transition:transform .26s cubic-bezier(.2,.75,.25,1),visibility .26s;isolation:isolate}
 .mobile-chat-panel.is-open{transform:translateY(0);visibility:visible;pointer-events:auto}
 .mobile-chat-panel iframe{width:100%;flex:1;min-height:0;border:0;display:block;background:#f3f6fa}
 .mobile-chat-status{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:#f3f6fa;color:#5d7387;text-align:center;padding:24px;font-size:14px}
 .mobile-chat-status[hidden]{display:none}
 .mobile-chat-status button{font:inherit;border:0;border-radius:12px;background:#1e5fc0;color:white;padding:10px 20px;cursor:pointer}
 .mobile-chat-status button[hidden]{display:none}
 .mobile-chat-open .mobile-tabbar{bottom:var(--chat-keyboard-inset,0px);z-index:300}
}
@media(prefers-reduced-motion:reduce){.mobile-chat-panel{transition:none}}

/* ส่วนบัญชีในเมนูมือถือ: สไตล์ premium */

/* แถบเมนูล่างแบบ Instagram: ไอคอนล้วน เส้นบางด้านบน ไอคอนทึบเมื่อเลือก รูปโปรไฟล์ทางขวา */
@media(max-width:720px){
 .layout>.content-area{padding-bottom:calc(58px + env(safe-area-inset-bottom))}
 .mobile-tabbar.ig-bar{gap:0;padding:0 4px env(safe-area-inset-bottom);background:#fff;border-top:.5px solid #dbdbdb;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none}
 .ig-bar button{min-height:50px;padding:0;color:#262626;border-radius:0}
 .ig-bar button::before,.ig-bar button.pop::after{display:none}
 .ig-bar button>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
 .ig-bar button svg{width:26px;height:26px;transform:none!important;transition:transform .15s}
 .ig-bar .i-f,.ig-bar button.active .i-o{display:none}
 .ig-bar button.active .i-f{display:block}
 .ig-bar button.active{color:#000}
 .ig-bar button:active svg,.ig-bar button:active .mt-avatar{transform:scale(.86)!important}
 .ig-bar button.pop svg{animation:mt-pop .32s ease-out}
 .ig-bar .mt-avatar{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:linear-gradient(135deg,#8C8AF5,#4F4BC9);color:#fff;font:700 12px/1 inherit;font-style:normal;box-shadow:0 0 0 1px #dbdbdb;transition:box-shadow .15s,transform .15s}
 .ig-bar button.active .mt-avatar{box-shadow:0 0 0 2px #fff,0 0 0 3.5px #000}
 .ig-bar .mt-badge{top:6px;left:calc(50% + 5px);min-width:17px;height:17px;line-height:17px;padding:0 4px;font-size:10.5px;background:#ff3040;box-shadow:0 0 0 2px #fff}
 .ig-bar .mt-dot{top:9px;left:calc(50% + 9px);width:8px;height:8px;background:#ff3040}
 html[data-theme="dark"] .mobile-tabbar.ig-bar{background:#000;border-top-color:#262626}
 html[data-theme="dark"] .ig-bar button,html[data-theme="dark"] .ig-bar button.active{color:#f5f5f5}
 html[data-theme="dark"] .ig-bar .mt-avatar{box-shadow:0 0 0 1px #363636}
 html[data-theme="dark"] .ig-bar button.active .mt-avatar{box-shadow:0 0 0 2px #000,0 0 0 3.5px #f5f5f5}
 html[data-theme="dark"] .ig-bar .mt-badge,html[data-theme="dark"] .ig-bar .mt-dot{box-shadow:0 0 0 2px #000}
}
/* แถบล่างลอย (IG ใหม่): แคปซูลโปร่งแสง เว้นขอบรอบด้าน */
@media(max-width:720px){
 .layout>.content-area{padding-bottom:calc(84px + env(safe-area-inset-bottom))}
 .mobile-tabbar.ig-bar{left:12px;right:12px;bottom:calc(10px + env(safe-area-inset-bottom));padding:0 6px;border:.5px solid rgba(0,0,0,.08);border-radius:999px;background:rgba(255,255,255,.72);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);box-shadow:0 8px 28px rgba(20,40,70,.18),inset 0 1px 0 rgba(255,255,255,.6)}
 .ig-bar button{min-height:56px;border-radius:999px}
 .ig-bar .mt-badge{box-shadow:0 0 0 2px rgba(255,255,255,.9)}
 html[data-theme="dark"] .mobile-tabbar.ig-bar{background:rgba(22,22,24,.72);border-color:rgba(255,255,255,.1);box-shadow:0 8px 28px rgba(0,0,0,.5),inset 0 1px 0 rgba(255,255,255,.08)}
 .mobile-chat-open .mobile-tabbar.ig-bar{bottom:calc(10px + var(--chat-keyboard-inset,0px) + env(safe-area-inset-bottom))}
}
/* เมนูบัญชีเลื่อนขึ้นจากปุ่มบัญชีที่แถบล่าง */
.acct-sheet,.acct-sheet-backdrop{display:none}
@media(max-width:720px){
 .acct-sheet-backdrop{display:block;position:fixed;inset:0;z-index:298;background:rgba(15,30,50,.28);backdrop-filter:blur(2px);opacity:0;pointer-events:none;transition:opacity .22s}
 .acct-sheet-backdrop.is-open{opacity:1;pointer-events:auto}
 .acct-sheet{display:grid;gap:6px;position:fixed;left:12px;right:12px;bottom:calc(76px + env(safe-area-inset-bottom));z-index:299;max-height:calc(100dvh - 140px);overflow:auto;padding:8px 10px 10px;border-radius:24px;background:rgba(255,255,255,.9);backdrop-filter:blur(22px) saturate(180%);-webkit-backdrop-filter:blur(22px) saturate(180%);border:.5px solid rgba(0,0,0,.06);box-shadow:0 18px 40px rgba(20,40,70,.25);transform:translateY(24px) scale(.97);transform-origin:85% 100%;opacity:0;visibility:hidden;transition:transform .28s cubic-bezier(.2,.9,.3,1.15),opacity .2s,visibility .28s}
 .acct-sheet.is-open{transform:none;opacity:1;visibility:visible}
 .as-grab{justify-self:center;width:38px;height:4px;border-radius:9px;background:#cfd8e2;margin:2px 0 4px}
 .as-user{display:flex;align-items:center;gap:12px;padding:10px;border-radius:18px;background:linear-gradient(135deg,#8C8AF5,#4F4BC9);color:#fff;box-shadow:0 8px 20px rgba(79,75,201,.3)}
 .as-user strong{display:block;font-size:15px}.as-user small{display:block;font-size:12px;opacity:.85}
 .as-avatar{display:grid;place-items:center;flex:none;width:42px;height:42px;border-radius:50%;background:rgba(255,255,255,.22);box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.5);font-weight:700;font-size:17px}
 .as-item{display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:8px 12px;border:0;border-radius:16px;background:#fff;color:#24415e;font:inherit;font-size:15px;text-align:left;box-shadow:-3px -3px 7px #fff,3px 3px 8px #d3dde8;cursor:pointer;transition:transform .15s}
 .as-item:active{transform:scale(.98)}
 .as-item[hidden]{display:none}
 .as-ic{display:grid;place-items:center;flex:none;width:34px;height:34px;border-radius:11px;color:#fff}
 .as-ic svg{width:18px;height:18px}
 .as-ic.c-mint{background:linear-gradient(135deg,#3DD6A8,#109A78)}.as-ic.c-indigo{background:linear-gradient(135deg,#8C8AF5,#4F4BC9)}.as-ic.c-slate{background:linear-gradient(135deg,#8fa3b8,#56687c)}
 .as-badge{margin-left:auto;padding:3px 11px;border-radius:999px;background:#e3f8f1;color:#0d7d62;font-size:13px}
 .as-chev{margin-left:auto;width:7px;height:7px;border-right:2px solid #8aa0b5;border-bottom:2px solid #8aa0b5;transform:rotate(-45deg)}
 .as-sep{border:0;height:1px;background:#e3eaf1;margin:2px 6px}
 .as-viewas:empty{display:none}
 .as-viewas .view-as-wrap{display:block!important}
 .as-viewas .top-viewas{display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:8px 12px;font-size:15px;width:100%;min-height:52px;border:0;border-radius:16px;background:#fff;box-shadow:-3px -3px 7px #fff,3px 3px 8px #d3dde8}
 .as-danger span:not(.as-ic){color:#4d5f72}
 html[data-theme="dark"] .acct-sheet{background:rgba(22,26,32,.9);border-color:rgba(255,255,255,.08)}
 html[data-theme="dark"] .as-item,html[data-theme="dark"] .as-viewas .top-viewas{background:#1d2b3b;color:#d6e2ee;box-shadow:none}
 html[data-theme="dark"] .as-sep{background:#2a3848}
 html[data-theme="dark"] .as-grab{background:#3a4858}
 html[data-theme="dark"] .as-danger span:not(.as-ic){color:#b5c4d3}
}
@media(prefers-reduced-motion:reduce){.acct-sheet,.acct-sheet-backdrop{transition:none}}

/* เมนูลัดของฉัน (เมนูด้านซ้าย ทั้ง PC และมือถือ) */
@media all{
 .mobile-shortcuts{display:block;margin-top:14px;padding:14px 2px calc(96px + env(safe-area-inset-bottom));border-top:1px solid #d3e0ec}
 .ms-head{display:flex;align-items:center;justify-content:space-between;margin:0 4px 10px}
 .ms-head strong{font-size:14px;color:#24415e}
 .ms-edit{border:0;background:#e9f0f7;color:#1A70CD;font:inherit;font-size:13px;font-weight:600;padding:5px 12px;border-radius:999px;cursor:pointer}
 .ms-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px 8px}
 .ms-item{position:relative}
 .ms-go,.ms-add{display:flex;flex-direction:column;align-items:center;gap:6px;width:100%;padding:0;border:0;background:none;font:inherit;color:#24415e;cursor:pointer}
 .ms-ic{display:grid;place-items:center;width:54px;height:54px;border-radius:17px;color:#fff;font-size:12px;font-weight:700;background:linear-gradient(135deg,var(--a,#58A8F0),var(--b,#1A70CD));box-shadow:0 7px 16px color-mix(in srgb,var(--b,#1A70CD) 30%,transparent);transition:transform .15s}
 .ms-ic svg{width:24px;height:24px;stroke:#fff}
 .ms-ic b{font-size:20px}
 .ms-go:active .ms-ic,.ms-add:active .ms-ic{transform:scale(.9)}
 .ms-label{max-width:100%;font-size:11.5px;line-height:1.25;text-align:center;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
 .ms-add .ms-ic{background:#fff;color:#1A70CD;font-size:28px;font-weight:400;box-shadow:inset 0 0 0 1.5px #b9cde0;border:0}
 .t-blue{--a:#58A8F0;--b:#1A70CD}.t-teal{--a:#2CC4B8;--b:#0E8A8F}.t-indigo{--a:#8C8AF5;--b:#4F4BC9}.t-cyan{--a:#4CC9F0;--b:#0A88B8}.t-mint{--a:#3DD6A8;--b:#109A78}.t-violet{--a:#7AA2F7;--b:#3550C9}
 .ms-del,.ms-left{display:none;position:absolute;top:-6px;width:24px;height:24px;border-radius:50%;border:2px solid #fff;color:#fff;font:700 15px/1 inherit;cursor:pointer;padding:0}
 .ms-del{right:calc(50% - 36px);background:#e5383b}
 .ms-left{left:calc(50% - 36px);background:#5f7b97}
 .ms-left[disabled]{opacity:.35}
 .editing .ms-del,.editing .ms-left{display:grid;place-items:center}
 .editing .ms-ic{animation:msWiggle .3s ease-in-out infinite alternate}
 .editing .ms-add{opacity:.4;pointer-events:none}
 @keyframes msWiggle{from{transform:rotate(-2.5deg)}to{transform:rotate(2.5deg)}}
 .ms-msg{margin:8px 4px 0;font-size:12.5px;color:#b53543}
 .ms-picker:not([hidden]){display:flex;align-items:flex-end;position:fixed;inset:0;z-index:310;background:rgba(15,30,50,.35);backdrop-filter:blur(2px)}
 .msp-card{width:100%;max-height:78dvh;display:flex;flex-direction:column;background:#f4f8fc;border-radius:24px 24px 0 0;padding:14px 14px calc(14px + env(safe-area-inset-bottom));animation:mspUp .26s cubic-bezier(.2,.9,.3,1)}
 @keyframes mspUp{from{transform:translateY(40px);opacity:.4}to{transform:none;opacity:1}}
 .msp-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
 .msp-head strong{font-size:16px;color:#24415e}
 .msp-close{width:34px;height:34px;border:0;border-radius:50%;background:#e3ebf3;color:#40607e;font-size:20px;cursor:pointer}
 .msp-list{overflow:auto;display:grid;gap:6px;padding-bottom:4px}
 .msp-list h4{margin:10px 4px 2px;font-size:12px;color:#6a8299;font-weight:600}
 .msp-item{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:46px;padding:8px 14px;border:0;border-radius:14px;background:#fff;color:#24415e;font:inherit;font-size:14.5px;text-align:left;box-shadow:0 2px 6px rgba(30,60,90,.06);cursor:pointer}
 .msp-item i{font-style:normal;display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#e5effb;color:#1A70CD;font-weight:700}
 .msp-item.on{opacity:.55}.msp-item.on i{background:#dff6ee;color:#109A78}
 html[data-theme="dark"] .mobile-shortcuts{border-top-color:#2a3848}
 html[data-theme="dark"] .ms-head strong,html[data-theme="dark"] .ms-go,html[data-theme="dark"] .ms-add{color:#d6e2ee}
 html[data-theme="dark"] .ms-edit{background:#1d2b3b;color:#8cc4f5}
 html[data-theme="dark"] .ms-add .ms-ic{background:#1d2b3b;color:#8cc4f5;box-shadow:inset 0 0 0 1.5px #3a4c60}
 html[data-theme="dark"] .msp-card{background:#121c27}
 html[data-theme="dark"] .msp-item{background:#1d2b3b;color:#d6e2ee}
 html[data-theme="dark"] .msp-head strong{color:#d6e2ee}
 html[data-theme="dark"] .msp-close{background:#22313f;color:#c4d2df}
}
@media(prefers-reduced-motion:reduce){.editing .ms-ic,.msp-card{animation:none}}
/* ช่องค้นหามือถือ: ปกติเป็นแว่นขยายกลม กดแล้วกางเป็นช่องค้นหาเต็มแถว */
@media(max-width:720px){
 .layout #globalSearch{flex:0 0 42px;flex-grow:0;width:42px;height:42px;min-width:42px;margin-left:auto;border-radius:999px;background:#fff;box-shadow:0 4px 12px rgba(36,72,112,.12);transition:flex-grow .32s cubic-bezier(.2,.8,.2,1),box-shadow .2s}
 .layout #globalSearch .gs-icon{left:11.5px;color:#3d5a78}
 .layout #globalSearch input{position:absolute;inset:0;width:100%;height:100%;border:0;border-radius:999px;padding:0 84px 0 42px;background:transparent;box-shadow:none;opacity:0;font-size:16px;cursor:pointer;transition:opacity .2s}
 .layout #globalSearch input:focus{border:0;outline:none;background:transparent;box-shadow:none}
 .layout #globalSearch input::-webkit-search-cancel-button{display:none}
 .layout #globalSearch:focus-within,.layout #globalSearch.has-value{flex-grow:1;box-shadow:0 0 0 2px #2CC4B8,0 8px 20px rgba(14,138,143,.18)}
 .layout #globalSearch:focus-within input,.layout #globalSearch.has-value input{opacity:1;cursor:text}
 .layout #globalSearch .gs-go,.layout #globalSearch .gs-clear{display:grid;place-items:center;position:absolute;top:50%;transform:translateY(-50%);border:0;border-radius:50%;padding:0;opacity:0;pointer-events:none;transition:opacity .2s}
 .layout #globalSearch .gs-go{right:3px;width:36px;height:36px;color:#fff;background:linear-gradient(135deg,#2CC4B8,#0E8A8F)}
 .layout #globalSearch .gs-clear{right:44px;width:28px;height:28px;font-size:18px;line-height:1;color:#5b7189;background:#eef3f8}
 .layout #globalSearch:focus-within .gs-go,.layout #globalSearch.has-value .gs-go,.layout #globalSearch.has-value .gs-clear{opacity:1;pointer-events:auto}
 html[data-theme="dark"] .layout #globalSearch{background:#1d2b3b;box-shadow:0 4px 12px rgba(0,0,0,.35)}
 html[data-theme="dark"] .layout #globalSearch .gs-icon{color:#b7c8d8}
 html[data-theme="dark"] .layout #globalSearch input{color:#e3ecf4}
}
@media(max-width:720px) and (prefers-reduced-motion:reduce){.layout #globalSearch{transition:none}}
/* เมนูลัดบน PC: ไอคอนเล็กลงให้พอดีแถบซ้าย ตัวเลือกเป็นหน้าต่างกลางจอ */
@media(min-width:721px){
 .mobile-shortcuts{margin-top:12px;padding:12px 0 6px}
 .ms-grid{gap:10px 4px}
 .ms-ic{width:44px;height:44px;border-radius:14px}
 .ms-ic svg{width:20px;height:20px}.ms-ic b{font-size:17px}
 .ms-add .ms-ic{font-size:24px}
 .ms-label{font-size:11px}
 .ms-del,.ms-left{width:20px;height:20px;font-size:13px}
 .ms-del{right:calc(50% - 30px)}.ms-left{left:calc(50% - 30px)}
 .ms-go:hover .ms-ic,.ms-add:hover .ms-ic{transform:translateY(-2px)}
 .ms-picker:not([hidden]){align-items:center;justify-content:center}
 .msp-card{width:min(460px,92vw);max-height:80vh;border-radius:22px;padding:16px;box-shadow:0 24px 60px rgba(15,30,50,.3);animation:mspPop .22s cubic-bezier(.2,.9,.3,1.1)}
 .msp-item:hover:not([disabled]){background:#eef6ff}
 @keyframes mspPop{from{transform:scale(.95);opacity:0}to{transform:none;opacity:1}}
}

/* Keyboard open in the chat: hide the floating bar so the chat fills the space above the keyboard. */
@media(max-width:720px){.mobile-chat-open.chat-keyboard .mobile-tabbar,.mobile-chat-open.chat-keyboard .mobile-tabbar.ig-bar{display:none}.chat-keyboard .mobile-chat-panel{border-radius:0;transition:none}.mobile-chat-open.chat-keyboard .layout{visibility:hidden}.mobile-chat-open.chat-keyboard{background:#f2f2f7}}

/* เมนูมือถือ: เลื่อนเข้า/ออกแบบ iOS (spring curve) + ฉากหลังจางตาม · รองรับการปัดลากจาก drawer-swipe.js */
@media(max-width:720px){
 .layout>.sidebar{transition:transform .42s cubic-bezier(.32,.72,0,1),visibility 0s linear .42s;will-change:transform;backface-visibility:hidden}
 .mobile-nav-open .layout>.sidebar{transition:transform .42s cubic-bezier(.32,.72,0,1),visibility 0s}
 .mobile-nav-backdrop{transition:opacity .38s cubic-bezier(.32,.72,0,1)}
}
@media(max-width:720px) and (prefers-reduced-motion:reduce){.layout>.sidebar,.mobile-nav-open .layout>.sidebar,.mobile-nav-backdrop{transition:none}}
/* หน้าข้อความ (แอดมิน): สวิตช์อยู่ใต้ชื่อห้องในแชท · หน้าข้อเสนอแนะทับส่วนข้อความ ต่อจากหัวห้อง (top มาจาก school-chat-header) */
@media(max-width:720px){
 .mobile-chat-body{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}
 .mobile-chat-feedback{position:absolute;left:0;right:0;top:96px;bottom:0;overflow:auto;-webkit-overflow-scrolling:touch;padding:12px 14px 20px;background:#f2f2f7;z-index:2}
 .mobile-chat-feedback[hidden]{display:none}
 .mcf-note{margin:0 0 10px;font-size:12px;color:#7a8ea2;text-align:center}
 .mcf-list{display:grid;gap:10px}
 .mcf-item{padding:12px 14px;border:1px solid rgba(60,60,67,.13);border-radius:18px;background:#fff}
 .mcf-item p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;color:#1c1c1e;line-height:1.6;font-size:15px}
 .mcf-item time{display:block;margin-top:6px;font-size:12px;color:#8a8a8e}
 .mcf-empty{margin:0;padding:16px;border:1px dashed #cfd6e0;border-radius:14px;color:#6b7785;background:#fff;text-align:center}
 html[data-theme=dark] .mobile-chat-feedback{background:#000}
 html[data-theme=dark] .mcf-item{background:#1c1c1e;border-color:rgba(84,84,88,.55)}html[data-theme=dark] .mcf-item p{color:#f5f5f7}
 html[data-theme=dark] .mcf-empty{background:#1c1c1e;border-color:#3a3a3c;color:#a1a1a6}
}
