/* Shared UI scale from the interface audit. */
@media (min-width:761px){
 .content .card{padding:14px}.content button,.modal button{min-height:34px;padding:7px 11px;font-size:13px}
 .content input,.content select,.content textarea,.modal input,.modal select,.modal textarea{min-height:36px;padding:8px 10px;font-size:14px}
 .content .heading{margin-bottom:12px}.content .heading h2{font-size:23px}.content .heading p,.content .card p{font-size:13px;line-height:1.55}
 .bd-actions{gap:9px!important;margin:11px 0!important}.bd-action{min-height:74px!important;padding:12px!important;border-radius:12px!important}
 .bd-action span{font-size:20px!important}.bd-action b{font-size:13px!important}.bd-action small{font-size:11px!important;margin-top:4px!important}
 #view-leads .fc-content-panel,#fcPushPanel{padding:15px!important}
}
@media (max-width:760px){
 .content button,.modal button{min-height:42px;font-size:13px}.content input,.content select,.content textarea,.modal input,.modal select,.modal textarea{min-height:44px;font-size:16px}
 .content .card{padding:13px;border-radius:12px}.content .heading h2{font-size:21px}.content .heading p,.content .card p{font-size:13px;line-height:1.55}
 .bd-actions{grid-template-columns:1fr 1fr!important;gap:8px!important}.bd-action{min-height:76px!important;padding:11px!important}.bd-action small{font-size:11px!important}
 #fcLeadSectionSelect{width:100%;min-height:44px;font-size:15px}#websiteInboxPanel summary{min-height:42px!important}
 .fc-content-item{align-items:flex-start!important;padding:13px 0!important}.fc-content-item>button{flex:1;min-width:105px}
}

/* Owner-selected footer: six complete labels in one row.  Do not let an old
   fixed-width carousel clip names such as Manufacturing or Marketing & Leads. */
@media (max-width:760px){
 body .sidebar #nav.nav{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:58px!important;height:62px!important;gap:2px!important;overflow:hidden!important}
 body .sidebar #nav.nav button[data-view="overview"],
 body .sidebar #nav.nav button[data-view="billing"],
 body .sidebar #nav.nav button[data-view="labor"],
 body .sidebar #nav.nav button[data-view="materials"],
 body .sidebar #nav.nav button[data-view="manufacturing"],
 body .sidebar #nav.nav button[data-view="leads"]{flex:none!important;width:auto!important;min-width:0!important;max-width:none!important;height:58px!important;min-height:58px!important;padding:3px 1px!important;white-space:normal!important;overflow:hidden!important;text-overflow:clip!important;overflow-wrap:anywhere!important;word-break:normal!important;font-size:8px!important;line-height:1.05!important}
 body .sidebar #nav.nav button .icon{font-size:16px!important;line-height:1!important;flex:none!important}
}

/* Leads stays discoverable without loading every marketing workspace. */
.lead-section-picker{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 14px;margin:0 0 12px}
.lead-section-picker label{font-size:12px;font-weight:800;color:#6c4a35;text-transform:uppercase;letter-spacing:.06em}
.lead-section-picker select{min-width:230px;min-height:40px;border:1px solid #d9c6a9;border-radius:10px;background:#fffaf2;color:#432d20;padding:0 11px;font:700 13px inherit}
.lead-section-picker small{color:#7f6b5c;font-size:12px}
@media(max-width:620px){.lead-section-picker{align-items:stretch}.lead-section-picker select{width:100%}.lead-section-picker small{line-height:1.35}}

/* Canonical workspace navigation.  Retire old entries from both the desktop
   rail and the mobile dock; their screens remain reachable from their own
   workflow shortcuts, but they no longer duplicate the main navigation. */
#nav button[data-view="sitevisits"],
#nav button[data-view="cutlist"],
#nav button[data-view="machinery"],
#nav button[data-view="designs"]{display:none!important}

@media (max-width:760px){
 body .sidebar #nav.nav{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:58px!important;height:62px!important;gap:2px!important;overflow:hidden!important}
 body .sidebar #nav.nav button[data-view="overview"],
 body .sidebar #nav.nav button[data-view="billing"],
 body .sidebar #nav.nav button[data-view="labor"],
 body .sidebar #nav.nav button[data-view="materials"],
 body .sidebar #nav.nav button[data-view="manufacturing"],
 body .sidebar #nav.nav button[data-view="leads"]{display:flex!important;flex:none!important;width:auto!important;min-width:0!important;max-width:none!important;height:58px!important;min-height:58px!important;padding:3px 1px!important;white-space:normal!important;overflow:hidden!important;text-overflow:clip!important;overflow-wrap:anywhere!important;font-size:8px!important;line-height:1.05!important}
}
/* Mobile Manufacturing menu: keep every Build option visible and tappable. */
@media (max-width:760px){
 #view-manufacturing[data-build-admin="yes"]{display:block!important;overflow:visible!important}
 #view-manufacturing[data-build-admin="yes"]>#buildAdminDesk{display:block!important;width:100%!important;min-width:0!important;overflow:visible!important}
 #view-manufacturing #buildAdminDesk .bd-head{display:flex!important;align-items:center!important;flex-wrap:wrap!important}
 #view-manufacturing #buildAdminDesk .bd-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important;gap:9px!important;overflow:visible!important}
 #view-manufacturing #buildAdminDesk .bd-action{display:grid!important;grid-template-columns:24px minmax(0,1fr)!important;visibility:visible!important;opacity:1!important;width:100%!important;min-width:0!important;min-height:82px!important;padding:12px!important}
 #view-manufacturing #buildAdminDesk .bd-action span{grid-row:1/3!important;font-size:20px!important}
 #view-manufacturing #buildAdminDesk .bd-action b,#view-manufacturing #buildAdminDesk .bd-action small{display:block!important;min-width:0!important;overflow-wrap:anywhere!important}
 #view-manufacturing .manufacturing-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important;gap:8px!important;overflow:visible!important}
 #view-manufacturing .manufacturing-actions button{display:flex!important;visibility:visible!important;white-space:normal!important;width:100%!important;min-width:0!important;min-height:44px!important}
}
@media (max-width:390px){#view-manufacturing #buildAdminDesk .bd-actions{grid-template-columns:1fr!important}}

/* Mobile shell: keep navigation labels and content columns from overlapping. */
@media (max-width:760px){
 html,body,.app,.main{max-width:100%;overflow-x:hidden}
 .sidebar{overflow:hidden!important}
 .sidebar .nav{display:flex!important;width:100%!important;justify-content:flex-start!important;overflow-x:auto!important;overflow-y:hidden!important;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding:0 3px 2px}
 .sidebar .nav::-webkit-scrollbar{display:none}
 .sidebar .nav button{flex:0 0 78px!important;width:78px!important;min-width:78px!important;max-width:78px!important;overflow:hidden!important;white-space:nowrap!important;scroll-snap-align:start;padding:6px 3px!important;font-size:9px!important}
 .sidebar .nav button .icon{flex:none}
 .sidebar .nav button span:not(.icon){display:block;max-width:72px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 body .sidebar #nav.nav{display:flex!important;grid-template-columns:none!important;grid-template-rows:none!important;height:60px!important;min-height:0!important;justify-content:flex-start!important;overflow-x:auto!important;overflow-y:hidden!important}
 body .sidebar #nav.nav button{flex:0 0 78px!important;width:78px!important;min-width:78px!important;max-width:78px!important;height:56px!important;min-height:54px!important;padding:5px 3px!important;font-size:10px!important;white-space:nowrap!important;overflow:hidden!important}
 .content,.view,.card,.stat,.row,.row-main,.toolbar,.grid2,.billing-grid,.supplier-grid,.machine-grid,.form-grid{min-width:0!important;max-width:100%}
 .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .toolbar>*{min-width:0;max-width:100%}
 .table-wrap{width:100%;max-width:100%;overflow-x:auto!important}
}

/* Mobile operations: keep the Build menu readable and clear fixed billing controls above the app navigation. */
@media (max-width:480px){
 #view-manufacturing #buildAdminDesk .bd-actions{grid-template-columns:1fr!important}
 #view-manufacturing #buildAdminDesk .bd-action{grid-template-columns:30px minmax(0,1fr)!important;column-gap:10px!important;align-items:start!important;min-height:88px!important}
 #view-manufacturing #buildAdminDesk .bd-action span{width:30px!important;line-height:1.2!important;text-align:center!important}
 #view-manufacturing #buildAdminDesk .bd-action b,#view-manufacturing #buildAdminDesk .bd-action small{line-height:1.3!important;white-space:normal!important;overflow-wrap:anywhere!important}
 #view-overview .dashboard-shortcut[data-goto="manufacturing"]{display:none!important}
 #view-billing[data-party-screen="desk"],#view-billing[data-party-detail="yes"]{padding-bottom:174px!important}
 #billingReferenceDock{bottom:calc(82px + env(safe-area-inset-bottom))!important;z-index:19!important}
}

/* Mobile footer: only the six workshop sections selected by the owner. */
@media (max-width:760px){
 body .sidebar{height:calc(146px + env(safe-area-inset-bottom))!important;padding:6px 7px env(safe-area-inset-bottom)!important}
 body .sidebar #nav.nav{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(2,62px)!important;height:130px!important;gap:3px!important;overflow:hidden!important}
 body .sidebar #nav.nav button{display:none!important;min-width:0!important;width:auto!important;max-width:none!important;height:60px!important;min-height:60px!important;padding:5px 3px!important;font-size:10px!important;line-height:1.14!important;white-space:normal!important;overflow:hidden!important;text-overflow:clip!important}
 body .sidebar #nav.nav button[data-view="overview"],
 body .sidebar #nav.nav button[data-view="billing"],
 body .sidebar #nav.nav button[data-view="labor"],
 body .sidebar #nav.nav button[data-view="materials"],
 body .sidebar #nav.nav button[data-view="manufacturing"],
 body .sidebar #nav.nav button[data-view="leads"]{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important}
 body .sidebar #nav.nav button .icon{font-size:19px!important;line-height:1!important}
 body .main{padding-bottom:calc(162px + env(safe-area-inset-bottom))!important}
}

/* Final mobile footer: a single stable row.  It must never be reflowed into
   two lines as that pushes the page/header out of the available viewport. */
@media (max-width:760px){
 body .sidebar{height:76px!important;padding:7px 6px calc(7px + env(safe-area-inset-bottom))!important}
 body .sidebar #nav.nav{display:flex!important;flex-wrap:nowrap!important;align-items:stretch!important;height:62px!important;gap:2px!important;overflow-x:auto!important;overflow-y:hidden!important;scroll-snap-type:x mandatory!important}
 body .sidebar #nav.nav button[data-view="overview"],
 body .sidebar #nav.nav button[data-view="billing"],
 body .sidebar #nav.nav button[data-view="labor"],
 body .sidebar #nav.nav button[data-view="materials"],
 body .sidebar #nav.nav button[data-view="manufacturing"],
 body .sidebar #nav.nav button[data-view="leads"]{display:flex!important;flex:0 0 76px!important;width:76px!important;min-width:76px!important;height:58px!important;min-height:58px!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;scroll-snap-align:start!important}
 body .sidebar #nav.nav button .icon{font-size:17px!important;line-height:1!important}
 body .sidebar #nav.nav button{font-size:9px!important;line-height:1.05!important;white-space:nowrap!important;text-overflow:ellipsis!important}
 body .main{padding-bottom:92px!important}
 /* Dashboard should not request or paint workshop photo backgrounds on mobile.
    The same imagery remains available in the Manufacturing screen. */
 #view-overview .mf-flow-card,#view-overview .mf-stage>summary{background-image:none!important;padding-top:18px!important}
 #view-overview .mf-flow-card::before{content:'Workshop process';display:block;margin-bottom:8px;color:#76543e;font-size:11px;font-weight:700}
}

/* Final precedence: preserve all six owner-selected labels without a carousel. */
@media (max-width:760px){
 body .sidebar #nav.nav{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;grid-template-rows:58px!important;height:62px!important;gap:2px!important;overflow:hidden!important}
 body .sidebar #nav.nav button[data-view="overview"],
 body .sidebar #nav.nav button[data-view="billing"],
 body .sidebar #nav.nav button[data-view="labor"],
 body .sidebar #nav.nav button[data-view="materials"],
 body .sidebar #nav.nav button[data-view="manufacturing"],
 body .sidebar #nav.nav button[data-view="leads"]{display:flex!important;flex:none!important;width:auto!important;min-width:0!important;max-width:none!important;height:58px!important;min-height:58px!important;padding:3px 1px!important;white-space:normal!important;overflow:hidden!important;text-overflow:clip!important;overflow-wrap:anywhere!important;font-size:8px!important;line-height:1.05!important}
 body .sidebar #nav.nav button .icon{font-size:16px!important;line-height:1!important;flex:none!important}
}
