/* ===== App mode: the app fills the phone screen at any size (no preview frame) ===== */
html,body{height:100%;margin:0;overscroll-behavior:none}
body.st-app{background:var(--cream,#f5f7f3)!important;background-image:none!important;-webkit-tap-highlight-color:transparent}
body.st-app .shell{padding:0!important;max-width:none!important;margin:0!important;width:100%!important}
body.st-app .top,body.st-app .note,body.st-app #stOfflineStatus,body.st-app #desktopFrame{display:none!important}
body.st-app .stage{display:block!important}
body.st-app .phone{width:100%!important;max-width:none!important;padding:0!important;border-radius:0!important;background:none!important;box-shadow:none!important;margin:0!important;transform:none!important;animation:none!important}
body.st-app .phone:before,body.st-app .phone .notch{display:none!important}
body.st-app .phone .screen{height:100vh!important;height:100dvh!important;min-height:0!important;border-radius:0!important;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);box-sizing:border-box}
body.st-app .phone .appbar{padding-top:16px!important}
body.st-app .phone .drawer-overlay{border-radius:0!important}
body.st-app .phone .drawer-overlay .drawer{top:calc(8px + env(safe-area-inset-top,0px))!important;bottom:calc(8px + env(safe-area-inset-bottom,0px))!important;left:8px!important;width:min(calc(100% - 16px),360px)!important;padding:16px 14px!important}
/* Keep the header and logout outside the scrolling menu, including on short screens. */
body.st-app .phone .drawer-overlay .drawer{height:auto!important;max-height:none!important;overflow:hidden!important}
body.st-app .phone .drawer-user{flex:0 0 auto!important;min-width:0;padding-top:0!important}
body.st-app .phone .drawer-user>div:last-child{min-width:0;overflow-wrap:anywhere}
body.st-app .phone .drawer-user .avatar{flex-shrink:0}
body.st-app .phone .drawer-nav{flex:1 1 0!important;min-height:0!important;overflow-x:hidden!important;overflow-y:auto!important;display:block!important;margin:0!important;padding:0 0 8px!important;overscroll-behavior:contain}
body.st-app .phone .drawer-nav .dnav{height:auto!important;min-height:48px!important;box-sizing:border-box;line-height:1.4!important;white-space:normal!important;overflow-wrap:anywhere;padding:12px 10px!important;margin:2px 0!important}
body.st-app .phone .drawer-nav .dnav i{flex:0 0 24px;line-height:1.2;text-align:center}
body.st-app .phone .drawer-logout{flex:0 0 auto!important;margin-top:8px!important;min-height:48px;box-sizing:border-box}
body.st-app .login-screen{padding-top:calc(48px + env(safe-area-inset-top,0px))!important}
body.st-app .login-hint a,body.st-app .login-links a{color:var(--gold-dark,#886c3c);font-weight:700;cursor:pointer}
body.st-app #stLoginErr{width:100%;margin:10px 0 0;font-size:12.5px}
body.st-app .btn-primary:disabled{opacity:.6}
/* Tablets: keep the phone layout but give content a comfortable width */
@media (min-width:700px){body.st-app #phoneScreens>.content>*{max-width:760px;margin-left:auto;margin-right:auto}}

/* Offline / sync bar */
#stNetBar{position:absolute;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));z-index:60;background:#103b34;color:#fff;border-radius:12px;padding:9px 14px;font:600 12.5px/1.3 Inter,system-ui,sans-serif;text-align:center;box-shadow:0 8px 24px rgba(0,0,0,.25);pointer-events:none}
#stNetBar.off{background:#7a6329}
#stNetBar[hidden]{display:none}

/* Role-based actions (the server enforces the same rules) */
body.role-client [data-act^="openActivityForm"],body.role-client [data-act^="openOrderForm"],body.role-client [data-act^="openRecoveryForm"],
body.role-client [data-act^="openAddClient"],body.role-client [data-act^="openClientReset"],body.role-client [data-act^="openClientAccount"],
body.role-client [data-act^="openGenericClientForm"],body.role-client #sheetBody .action-grid,body.role-client #sheetBody .inline-actions,
body.role-client .s-actions .s-btn.primary,body.role-client [data-act^="addOrderProductRow"]{display:none!important}
body.role-client #sheetBody .sheet-section:has(>.action-grid){display:none!important}
body.role-sales [data-act^="openAddProduct"],body.role-sales [data-act^="openEditProduct"],body.role-sales [data-act^="openAddSalesPerson"],
body.role-sales [data-act^="openEditSalesPerson"],body.role-sales [data-act^="openTeamCreate"],body.role-sales [data-act^="openTeamAssignments"],
body.role-sales [data-act^="openRegionCreate"],body.role-sales [data-act^="openRegionAssignments"],body.role-sales [data-act^="openClientReset"],
body.role-sales [data-act^="openClientAccount"],body.role-sales [data-act^="stAccessPerson"]{display:none!important}
body.role-sales #phoneScreens .action-grid:not(:has(> :not([style*="none"])))
{display:none}
body.role-sales #phoneScreens h2.section:has(+ .action-grid [data-act^="openTeamCreate"]),body.role-sales #phoneScreens .action-grid:has([data-act^="openTeamCreate"]){display:none!important}
/* Printing is not available inside phone apps */
body.st-app [data-act="window.print"]{display:none!important}

/* Sign-in: green header ends above the first label */
body.st-app .login-screen{background:linear-gradient(180deg,#0d4036 0,#0c302e calc(218px + env(safe-area-inset-top,0px)),#f5f7f3 calc(218px + env(safe-area-inset-top,0px)))!important}
/* Messages sit above the offline/sync bar */
body.st-app .toast{bottom:calc(68px + env(safe-area-inset-bottom,0px))!important}

/* Managers: no catalogue, price, team or region changes (the server enforces the same) */
body.role-manager [data-act^="openAddProduct"],body.role-manager [data-act^="openEditProduct"],body.role-manager [data-act^="openTeamCreate"],
body.role-manager [data-act^="openTeamAssignments"],body.role-manager [data-act^="openRegionCreate"],body.role-manager [data-act^="openRegionAssignments"]{display:none!important}
body.role-manager #phoneScreens h2.section:has(+ .action-grid [data-act^="openTeamCreate"]),body.role-manager #phoneScreens .action-grid:has([data-act^="openTeamCreate"]){display:none!important}
