/* Shared responsive controls. Keep drawing coordinates inside the existing viewport. */
[hidden]{display:none!important}
:where(button,a,input,select,textarea):focus-visible{outline:3px solid #36aee6;outline-offset:3px}
.sitepec-menu-toggle{display:none}
.sitepec-project-links{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.sitepec-project-links a{position:static!important;inset:auto!important;z-index:auto!important;display:inline-flex!important;align-items:center;min-height:44px;text-decoration:none;font-size:13px!important}
.sitepec-tool-label{display:none}
body #sitepec-connection-status{position:static!important;inset:auto!important;max-width:none!important;transform:none!important;flex-shrink:0;margin:8px 0!important;box-sizing:border-box}
.modal-content,.disc-content{max-height:calc(100dvh - 32px);overflow-y:auto;overscroll-behavior:contain;box-sizing:border-box}
.sitepec-plan .main-container{min-height:0}
@media(max-width:900px){
 html{scroll-padding-top:12px}body{min-width:0}*,*::before,*::after{box-sizing:border-box}
 input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px!important;max-width:100%;min-width:0}
 button,.btn,.button{min-height:44px;touch-action:manipulation}
 .app{display:block!important;height:auto!important;min-height:100dvh;overflow:visible!important}
 .app>.sidebar{width:100%!important;height:auto!important;padding:12px 16px!important;position:relative!important;flex-shrink:0}
 .sidebar .user{display:flex!important;flex-direction:row!important;align-items:center!important;gap:12px!important;margin:0!important;min-width:0}
 .sidebar .user-logo-container{width:100px!important;height:42px!important;margin:0!important;flex:0 0 100px}
 .sidebar .user-logo{width:100%!important;height:42px!important;object-fit:contain!important}
 .sidebar .user>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px!important;flex:1}
 .sitepec-menu-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex-shrink:0;background:#243b4e;color:white;border:1px solid #607789;border-radius:8px;padding:8px 12px;font:600 14px system-ui}
 .sidebar .menu:not([hidden]){display:flex!important;flex-direction:column!important;overflow:visible!important;flex-wrap:nowrap!important;gap:6px!important;margin-top:12px!important;width:100%!important}
 .sidebar .menu a{width:100%!important;min-height:44px;white-space:normal!important;display:flex!important;align-items:center;padding:10px 12px!important;margin:0!important}
 .sidebar .menu-title{margin:10px 0 4px!important}
 .app>.main{width:100%!important;min-width:0;padding:16px!important;height:auto!important;overflow:visible!important}
 .main .top-bar{display:flex!important;flex-wrap:wrap!important;gap:10px!important;align-items:stretch!important}
 .main .top-bar>*{min-width:0!important;max-width:100%}
 .main .top-bar input,.main .top-bar .search-box{width:100%!important;flex:1 1 100%!important}
 .project-grid,.projects-grid,.plans-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))!important;gap:14px!important}
 .project-card{min-width:0;overflow-wrap:anywhere}
 .modal,.modal-disciplines{padding:12px!important;align-items:center;overflow-y:auto;overscroll-behavior:contain}
 .modal-content,.disc-content{width:100%!important;max-width:560px!important;padding:20px!important;max-height:calc(100dvh - 24px);margin:auto!important}
 .modal-content button,.disc-content button{min-height:44px;white-space:normal}
 .modal-content input,.modal-content select,.modal-content textarea{min-width:0!important}
 .modal-content h2,.modal-content h3{overflow-wrap:anywhere;padding-right:10px}
 .modal-content .sitepec-close{min-width:44px;flex-shrink:0}
 .modal-content .buttons,.modal-content .btn-group{display:flex;flex-wrap:wrap;gap:8px}.modal-content .buttons>button,.modal-content .btn-group>button{flex:1;min-width:100px}
 dialog{max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important;padding:18px!important;overscroll-behavior:contain}
 .sitepec-plan{height:100dvh!important;height:var(--sitepec-height,100dvh)!important;width:100%!important;overflow:hidden!important}
 .sitepec-plan .main-container{height:100%!important;width:100%!important;padding:max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important;gap:0!important}
 .sitepec-plan header.sitepec-project-header{display:flex!important;flex-wrap:wrap!important;gap:8px!important;padding:8px 0!important;margin:0!important;flex-shrink:0;min-width:0}
 .sitepec-project-links{width:100%;gap:6px}
 .sitepec-project-links a{flex:1;justify-content:center;padding:8px!important;font-size:12px!important}
 .sitepec-project-title{width:100%!important;flex:1 1 100%!important;min-width:0;overflow:hidden}
 .sitepec-project-title h2{white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;font-size:15px!important}
 .sitepec-project-tools{width:100%!important;display:grid!important;grid-template-columns:repeat(var(--tool-count,5),minmax(0,1fr));gap:6px!important;align-items:stretch!important}
 .sitepec-project-tools>div{min-width:0;display:block!important}
 .sitepec-project-tools .sitepec-divider{display:none!important}
 .sitepec-project-tools>.btn,.sitepec-project-tools>div>.btn{width:100%!important;min-width:0!important;min-height:48px!important;padding:5px 2px!important;display:flex!important;flex-direction:column;justify-content:center;gap:3px!important;font-size:12px!important;margin:0!important}
 .sitepec-tool-label{display:inline;font:600 11px system-ui}
 .sitepec-icon-tool .sitepec-tool-label{display:none}.sitepec-icon-tool::after{content:attr(aria-label);font:600 11px system-ui}
 #shape-toolbar,#pencil-toolbar{position:fixed!important;left:12px!important;right:12px!important;top:var(--sitepec-tools-bottom,180px)!important;bottom:auto!important;width:auto!important;transform:none!important;flex-direction:row!important;flex-wrap:wrap;gap:8px!important;padding:12px!important;max-height:45dvh;overflow:auto;z-index:8000!important}
 #shape-toolbar button,#pencil-toolbar button{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;flex-shrink:0}
 #disc-tabs-bar{gap:5px!important;padding:6px 0!important;min-height:44px;scrollbar-width:thin}
 #disc-tabs-bar>a,#disc-tabs-bar>button,#disc-tabs-bar>span{min-height:44px!important;padding:8px 10px!important;flex-shrink:0}
 .thumb-nav{padding:8px!important;margin-top:6px!important;gap:8px!important;min-height:0;flex-shrink:0;max-height:88px;overflow-x:auto}
 .thumb-nav img{height:48px!important;width:64px!important;object-fit:contain}
 .viewport{min-height:80px!important}
 .notes-container{min-height:0!important}.notes-container textarea{padding:16px!important;min-height:0!important}.notes-save-bar{padding:8px!important;gap:8px;flex-wrap:wrap}
 .tablewrap{overflow:visible!important}.tablewrap table,.tablewrap tbody,.tablewrap tr,.tablewrap td{display:block;width:100%}
 .tablewrap thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .tablewrap tr{border:1px solid #dbe4eb;border-radius:10px;padding:10px;margin:12px 0}
 .tablewrap td{padding:8px 0!important;overflow-wrap:anywhere;border:0!important}
 .tablewrap td::before{content:attr(data-label);display:block;font-size:12px;color:#516577;font-weight:700;margin-bottom:4px}
 form.row .field{min-width:0!important;flex-basis:100%}form.row>button{width:100%}
 .notification-item{flex-wrap:wrap!important;gap:10px!important}.notif-content{min-width:0;overflow-wrap:anywhere;flex:1}.notif-actions{width:100%;display:flex;flex-wrap:wrap;gap:8px}.notif-actions a{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px}
 .sitepec-auth{display:block!important;min-height:100dvh!important;height:auto!important;padding:80px 16px 24px!important;overflow-y:auto!important}
 .sitepec-auth .top-bar{height:64px!important;padding:8px 16px!important;position:absolute!important;top:0;left:0;right:0}
 .sitepec-auth .top-bar img{height:48px!important;max-width:100%;object-fit:contain}
 .sitepec-auth .brand-text{display:none!important}.sitepec-auth .wrapper{width:100%!important;max-width:440px!important;margin:0 auto!important;padding:24px!important;transform:none!important}
 .sitepec-field .toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.sitepec-field .toolbar select{grid-column:1/-1;width:100%}
 .sitepec-field .toolbar button{min-width:0;white-space:normal;padding:9px 6px;font-size:14px}
 .sitepec-field .item-row{flex-wrap:wrap}.sitepec-field .item-row .text{min-width:0;flex-basis:100%}.sitepec-field .item-row .actions{max-width:none;width:100%;justify-content:flex-start}
 .sitepec-field .gallery figure{max-width:100%;flex:0 1 220px}.sitepec-field .gallery figure img{max-width:100%}
 .gallery{min-width:0}.sitepec-photo-library .gallery{grid-template-columns:minmax(0,1fr)!important}
}
@media(max-width:900px) and (max-height:500px){
 .sitepec-plan .sitepec-project-links{width:auto;flex:1}.sitepec-plan .sitepec-project-title{width:auto!important;flex:1!important}.sitepec-plan .sitepec-project-tools{width:auto!important;flex:1}.sitepec-project-tools .sitepec-tool-label{display:none}.sitepec-project-tools>.btn,.sitepec-project-tools>div>.btn{min-height:44px!important}#disc-tabs-bar{padding:3px 0!important}.thumb-nav{max-height:64px}
}
