/* All presentation changes are inside the site's original mobile breakpoint. */
@media (max-width:760px){
  html{scroll-padding-bottom:calc(84px + env(safe-area-inset-bottom,0px))}
  html body{overflow-x:clip}
  html body .sidebar,html body #mobile-menu,html body #mobile-close{display:none!important}
  html body .main-shell{width:100%;min-width:0}
  html body .topbar{height:auto;min-height:60px;padding:12px max(16px,env(safe-area-inset-right,0px)) 12px max(16px,env(safe-area-inset-left,0px));padding-top:max(12px,env(safe-area-inset-top,0px))}
  html body .breadcrumb{font-size:0;letter-spacing:0;min-width:0}
  html body .breadcrumb>span{display:none}
  html body .breadcrumb strong{font-size:14px;overflow-wrap:anywhere}
  html body main{min-width:0;max-width:100%;padding:22px max(16px,env(safe-area-inset-right,0px)) calc(100px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
  html body .page-head{display:block}
  html body .page-actions{margin-top:14px}
  html body .page-head h1{overflow-wrap:anywhere}
  html body :is(.grid,.workspace,.two-col,.list-grid,.form-grid,.modal-fields,.role-menu-grid,.poll-form-options,.scope-options,.mode-panel){grid-template-columns:minmax(0,1fr)!important}
  html body :is(.span-2,.span-3,.field.full,.modal-fields .full,.mode-panel .full){grid-column:1/-1}
  html body :is(.field,.scope-group,.card,.composer-block,.preview-aside){min-width:0;max-width:100%}
  html body :is(#app,#form-dialog,#confirm-dialog) button{min-height:44px;min-width:44px}
  html body :is(#app,#form-dialog,#confirm-dialog) :is(.input,select,textarea){min-height:44px;font-size:16px!important;max-width:100%}
  html body :is(.checkbox-row,.toggle-row){min-height:44px}
  html body input[type="checkbox"]:not(.switch),html body input[type="radio"]{width:22px;height:22px;flex:none}
  html body input.switch{width:56px;height:44px;min-height:44px}
  html body input.switch::before{width:24px;height:24px;top:10px;left:5px}
  html body input.switch:checked::before{transform:translateX(22px)}
  html body :is(.actions,.block-head,.card-header,.filterbar,.tabbar){flex-wrap:wrap}
  html body :is(.filterbar select,.filterbar .input){width:100%;max-width:none;min-width:0}
  html body .badge{white-space:normal}
  html body .channel-option{min-height:48px;white-space:normal}
  html body .channel-option small{float:none;display:block}
  html body .composer-actions{position:static}
  html body .preview-aside{position:static}
  html body .feed li{grid-template-columns:auto minmax(0,1fr)}
  html body .feed li>span:last-child{grid-column:1/-1;overflow-wrap:anywhere}
  html body :is(.table-wrap,.table,.table tbody){display:block;width:100%;min-width:0;max-width:100%}
  html body .table-wrap{overflow:visible}
  html body .table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  html body .table tr{display:block;padding:12px 16px;border-bottom:1px solid var(--border)}
  html body .table td{display:block;padding:8px 0!important;border:0;overflow-wrap:anywhere;white-space:normal}
  html body .table td[data-mobile-label]::before{content:attr(data-mobile-label);display:block;font-size:12px;font-weight:700;margin-bottom:5px;opacity:.8}
  html body .table td>*{max-width:100%;min-width:0}
  html body .table .actions{gap:8px}
  html body #toast-area{bottom:calc(86px + env(safe-area-inset-bottom,0px));right:max(16px,env(safe-area-inset-right,0px));max-width:calc(100vw - 32px);pointer-events:none}

  #mobile-bottom-nav{position:fixed;z-index:20;inset:auto 0 0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;padding:6px max(6px,env(safe-area-inset-right,0px)) calc(6px + env(safe-area-inset-bottom,0px)) max(6px,env(safe-area-inset-left,0px));background:var(--sidebar);color:var(--text);border-top:1px solid var(--border);box-shadow:0 -4px 18px #0002}
  #mobile-bottom-nav .mobile-nav-button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-width:0;min-height:58px;padding:6px 2px;border:1px solid transparent;border-radius:8px;background:transparent;color:inherit;font:600 12px/1.2 ui-sans-serif,system-ui,sans-serif;overflow-wrap:anywhere;touch-action:manipulation}
  #mobile-bottom-nav .mobile-nav-button[aria-current="page"],#mobile-bottom-nav .mobile-nav-button[aria-expanded="true"]{background:var(--surface2);color:var(--accent);border-color:var(--border)}
  .mobile-nav-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none;color:inherit}
  .mobile-nav-icon svg,.mobile-sheet-close svg{width:24px;height:24px;fill:none;stroke:currentColor;flex:none}
  body.mobile-keyboard-open #mobile-bottom-nav{display:none}

  html body #mobile-more-dialog[open]{display:flex;flex-direction:column;position:fixed;inset:auto 0 0;width:100%;max-width:none;height:min(86dvh,calc(var(--mobile-viewport-height,100dvh) - env(safe-area-inset-top,0px)));max-height:calc(var(--mobile-viewport-height,100dvh) - env(safe-area-inset-top,0px));margin:0;padding:0;background:var(--sidebar);color:var(--text);border:1px solid var(--border);border-bottom:0;border-radius:20px 20px 0 0;overflow:hidden;box-shadow:var(--shadow)}
  #mobile-more-dialog .mobile-more-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px max(16px,env(safe-area-inset-right,0px)) 12px max(16px,env(safe-area-inset-left,0px));flex:none;border-bottom:1px solid var(--border)}
  html body #mobile-more-dialog h2{font-size:22px;margin:0;padding:0;border:0;color:inherit}
  #mobile-more-dialog .mobile-more-pages{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;min-height:0;flex:1;padding:8px max(12px,env(safe-area-inset-right,0px)) 8px max(12px,env(safe-area-inset-left,0px))}
  #mobile-more-dialog .mobile-more-link{display:flex;align-items:center;gap:14px;width:100%;min-height:52px;margin:3px 0;padding:10px 12px;border:1px solid transparent;border-radius:8px;background:transparent;color:inherit;text-align:left;font-size:16px;touch-action:manipulation}
  #mobile-more-dialog .mobile-more-link[aria-current="page"]{background:var(--surface2);color:var(--accent);border-color:var(--border)}
  #mobile-more-dialog .mobile-active-label{display:none;margin-left:auto;font-size:11px}
  #mobile-more-dialog [aria-current="page"] .mobile-active-label{display:inline}
  #mobile-more-dialog .mobile-more-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;border-top:1px solid var(--border);padding:12px max(16px,env(safe-area-inset-right,0px)) calc(12px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
  #mobile-more-dialog .mobile-more-status{font-size:12px;overflow-wrap:anywhere}
  #mobile-more-dialog .mobile-sheet-close{display:flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:8px 12px;background:var(--surface2);color:inherit;border:1px solid var(--border);border-radius:8px;font-size:14px;flex:none}

  html.mobile-scroll-locked{overflow:hidden!important;overscroll-behavior:none}
  body.mobile-scroll-locked{position:fixed;top:var(--mobile-scroll-top,0);left:0;right:0;width:100%;overflow:hidden!important;overscroll-behavior:none}
  html body #form-dialog[open]{display:flex!important;flex-direction:column;position:fixed;top:var(--mobile-viewport-top,0);left:0;right:0;bottom:auto;margin:0!important;width:100%!important;max-width:none!important;height:var(--mobile-viewport-height,100dvh)!important;max-height:var(--mobile-viewport-height,100dvh)!important;border-radius:0!important;border-width:0!important;box-shadow:none!important;padding:max(12px,env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))!important;overflow:hidden!important}
  html body #form-dialog #modal-form{display:flex!important;flex-direction:column;flex:1;min-height:0!important;min-width:0;overflow:hidden!important}
  html body #form-dialog #form-content{flex:1;min-height:0!important;overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:0 2px 12px!important}
  html body #form-dialog #form-content>h2{position:sticky;top:0;z-index:3;background:var(--mobile-dialog-background,var(--surface));padding-top:8px;padding-bottom:12px;margin-top:0}
  html body #form-dialog .dialog-actions{flex:none!important;display:flex;flex-wrap:wrap;gap:10px;margin-top:0!important;padding-top:12px!important;border-top:1px solid var(--border)}
  html body #form-dialog .dialog-actions button{flex:1;min-height:48px}
  html body #form-dialog :is(.role-menu-choices,.slash-permission-choices){max-height:none;overflow:visible;grid-template-columns:minmax(0,1fr)}
  html body #form-dialog .modal-fields{padding-bottom:8px}
  html body #confirm-dialog[open]{position:fixed;top:calc(var(--mobile-viewport-top,0px) + max(12px,env(safe-area-inset-top,0px)));bottom:auto;width:calc(100% - 24px);max-width:calc(100% - 24px);max-height:calc(var(--mobile-viewport-height,100dvh) - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));margin:0 auto;padding:16px;overflow-y:auto;overscroll-behavior:contain}
  html body #confirm-dialog .dialog-actions{position:sticky;bottom:-16px;flex-wrap:wrap;background:var(--mobile-dialog-background,var(--surface));padding:12px 0 max(12px,env(safe-area-inset-bottom,0px));margin-top:12px}
  html body #confirm-dialog .dialog-actions button{flex:1;min-height:48px}
}
