/* Correction programme Stage 1 / v16.4.16 — ONE late-loaded presentation layer.
   Not a business/workflow stylesheet. Operates only in verified SaaS workspace.
   Wide registers retain their own horizontal scroll; no data, role or route changes. */
:root {--kv16-side-width:264px;--kv16-side-mini:72px;}
html,body {max-width:100%;}
body.server-authenticated {overflow-x:clip!important;}
body.server-authenticated .app-shell {display:grid!important;grid-template-columns:minmax(0,var(--kv16-side-width)) minmax(0,1fr)!important;min-width:0!important;max-width:100vw!important;align-items:stretch;}
body.server-authenticated .app-shell>#mainContent{min-width:0!important;width:100%;max-width:100%;overflow-x:clip;}
body.server-authenticated #app{box-sizing:border-box;min-width:0;max-width:100%;}
body.server-authenticated #app .master-table-scroll,body.server-authenticated #app .monthly-roster-scroll,body.server-authenticated #app .enterprise-table-scroll {max-width:100%;overflow-x:auto;}
/* Strict flex regions: only the links scroll. */
body.server-authenticated .app-shell>#sidebar {box-sizing:border-box;position:sticky!important;inset:0 auto auto 0!important;height:100dvh!important;max-height:100dvh!important;width:var(--kv16-side-width)!important;min-width:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;padding:12px 10px 10px!important;gap:0!important;border-right:1px solid #25534f;background-color:#082f2e;}
body.server-authenticated #sidebar .facility {order:0;flex:0 0 auto;display:flex;align-items:center;gap:9px;min-width:0;margin:0 0 6px!important;padding:10px 10px!important;border:1px solid #326560!important;border-radius:11px;background:rgba(255,255,255,.07);box-shadow:none;}
body.server-authenticated #sidebar .facility>div{min-width:0;flex:1;}
body.server-authenticated #sidebar .facility strong{font:700 13px/1.25 'DM Sans',sans-serif!important;color:#fff!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
body.server-authenticated #sidebar .facility small{font:500 10px/1.3 'DM Sans',sans-serif!important;color:#bed8d3!important;margin-top:3px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
body.server-authenticated #sidebar .brand {order:1;flex:0 0 auto;display:flex!important;align-items:center;min-width:0;margin:0 0 5px!important;padding:3px 9px 7px!important;gap:9px!important;border:0!important;opacity:.84;}
body.server-authenticated #sidebar .kebarick-logo-shell{width:27px!important;min-width:27px!important;height:24px!important;border-radius:5px!important;padding:2px!important;}
body.server-authenticated #sidebar .brand-copy{min-width:0!important;}
body.server-authenticated #sidebar .brand-copy strong{font:700 9px/1.15 'DM Sans',sans-serif!important;letter-spacing:.035em!important;}
body.server-authenticated #sidebar .brand-copy small{font:500 8px/1.2 'DM Sans',sans-serif!important;letter-spacing:.07em!important;}
body.server-authenticated #sidebar .kv-find-pages{order:2;flex:0 0 auto;min-width:0!important;padding:5px 2px 8px!important;}
body.server-authenticated #sidebar .kv-find-pages label{margin:0 6px 5px!important;font:700 10px/1.3 'DM Sans',sans-serif!important;letter-spacing:.025em!important;text-transform:none!important;color:#bedbd5!important;}
body.server-authenticated #sidebar .kv-find-row{min-height:37px!important;border-radius:9px!important;padding:0 9px!important;}
body.server-authenticated #sidebar .kv-find-row input{font:500 11px/1.35 'DM Sans',sans-serif!important;}
body.server-authenticated #sidebar .kv-find-meta{margin:4px 6px 0!important;min-height:0!important;font:400 9px/1.25 'DM Sans',sans-serif!important;}
body.server-authenticated #sidebar #nav{order:3;flex:1 1 0!important;min-height:0!important;height:auto!important;overflow-y:auto!important;overflow-x:hidden!important;padding:4px 1px 8px!important;scrollbar-gutter:auto!important;scrollbar-width:thin;scrollbar-color:#46736b transparent;overscroll-behavior:contain;}
body.server-authenticated #sidebar #nav .kv-nav-group{min-width:0!important;margin:0 0 4px!important;}
body.server-authenticated #sidebar #nav .kv-group-toggle{box-sizing:border-box;min-height:29px!important;height:auto!important;max-width:100%!important;padding:5px 9px!important;margin:3px 0 1px!important;display:flex!important;align-items:center;gap:8px;white-space:normal!important;text-align:left!important;border-radius:7px!important;color:#a8cdc6!important;font:700 10.5px/1.25 'DM Sans',sans-serif!important;letter-spacing:.01em!important;text-transform:none!important;}
body.server-authenticated #sidebar #nav .kv-group-toggle>span:first-child{display:block;flex:1;min-width:0;overflow-wrap:normal;word-break:normal;}
body.server-authenticated #sidebar #nav .kv-group-chevron{flex:none;font-size:13px!important;}
body.server-authenticated #sidebar #nav .kv-group-links>button[data-page]{box-sizing:border-box;display:flex!important;align-items:center!important;gap:9px!important;width:100%!important;min-width:0!important;max-width:100%!important;min-height:35px!important;margin:1px 0!important;padding:7px 9px!important;border-radius:8px!important;white-space:normal!important;overflow-wrap:break-word!important;word-break:normal!important;text-align:left!important;color:#d4e4e0!important;font:500 11.5px/1.25 'DM Sans',sans-serif!important;letter-spacing:0!important;transform:none!important;}
body.server-authenticated #sidebar #nav .kv-group-links>button[data-page].kv-page-hidden{display:none!important;}
body.server-authenticated #sidebar #nav .kv-group-links[hidden],body.server-authenticated #sidebar #nav .kv-nav-group[hidden]{display:none!important;}
body.server-authenticated #sidebar #nav button[data-page] .ico{flex:0 0 19px!important;width:19px!important;font-size:14px!important;line-height:1.2!important;color:#b3dad2!important;}
body.server-authenticated #sidebar #nav button[data-page].active{background:#087f75!important;color:#fff!important;border:1px solid #48a99b!important;font-weight:700!important;}
body.server-authenticated #sidebar #nav button[data-page]:focus-visible,body.server-authenticated #sidebar .kv-group-toggle:focus-visible{outline:2px solid #b5f5e6!important;outline-offset:0!important;}
body.server-authenticated #sidebar .sidebar-foot{order:4;flex:0 0 auto;position:relative!important;bottom:auto!important;display:flex!important;align-items:center!important;gap:6px!important;margin:0!important;min-height:55px!important;padding:9px 2px 4px!important;border-top:1px solid #2e5b55!important;background:#092f2e!important;}
body.server-authenticated #sidebar .sidebar-foot>div:nth-child(2){flex:1 1 0!important;min-width:0!important;overflow:hidden;}
body.server-authenticated #sidebar .sidebar-foot strong,body.server-authenticated #sidebar .sidebar-foot small{display:block!important;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
body.server-authenticated #sidebar .sidebar-foot strong{font-size:10.5px!important;line-height:1.25!important;}
body.server-authenticated #sidebar .sidebar-foot small{font-size:9px!important;line-height:1.25!important;}
body.server-authenticated #sidebar .sidebar-foot .mini-avatar{flex:none;width:30px;height:30px;}
body.server-authenticated #sidebar .sidebar-foot button{flex:none!important;width:26px!important;height:30px!important;margin:0!important;padding:3px!important;}
body.server-authenticated #sidebar .build-badge{order:5;position:static!important;inset:auto!important;align-self:flex-end!important;flex:0 0 auto;z-index:auto!important;margin:0 5px 0 0!important;padding:1px 3px!important;line-height:1!important;font:500 9px 'DM Sans',sans-serif!important;letter-spacing:0!important;border:0!important;box-shadow:none!important;background:none!important;color:#8fbdb5!important;}
/* In normal mode the collapse button is separate from permission-filtered page links. */
body.server-authenticated #sidebar #kv16Collapse{flex:none;align-self:center;border:1px solid rgba(202,250,239,.25);background:rgba(255,255,255,.07);color:#e5f5f0;border-radius:8px;width:30px;height:30px;display:grid;place-items:center;cursor:pointer;font-size:17px;line-height:1;}
body.server-authenticated #sidebar #kv16Collapse:hover{background:rgba(255,255,255,.18);}
/* Tenant identity is primary; product attribution is small. */
body.server-authenticated #mainContent>.topbar{max-width:100%;min-width:0;gap:12px!important;padding:9px 16px!important;min-height:67px!important;height:auto!important;display:flex;flex-wrap:wrap;align-items:center;}
body.server-authenticated #mainContent>.topbar .system-heading{min-width:135px;flex:1 1 230px;max-width:100%;}
body.server-authenticated #mainContent>.topbar .system-name{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:750 14px/1.3 'DM Sans',sans-serif!important;}
body.server-authenticated #mainContent>.topbar .top-actions{min-width:0;max-width:100%;flex:0 1 auto;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:7px!important;}
body.server-authenticated #mainContent>.topbar .top-actions>*{max-width:100%;}
body.server-authenticated #mainContent>.topbar .top-actions .search{width:clamp(130px,15vw,260px)!important;min-width:0!important;}
body.server-authenticated #mainContent>.topbar .top-actions #saasSubscriptionButton{max-width:180px!important;min-width:0!important;}
body.server-authenticated #mainContent>.topbar .kv-manual-toplink{font-size:11px!important;white-space:nowrap;}
/* Keep provider support accessible, without covering long forms and action rows. */
body.server-authenticated #kvChatBtn{width:48px!important;height:48px!important;min-width:48px!important;min-height:48px!important;right:15px!important;bottom:15px!important;padding:0!important;border-radius:50%!important;display:grid;place-items:center;line-height:1!important;}
body.server-authenticated #kvChatBtn[hidden]{display:none!important;}
body.server-authenticated #kvChatBtn::before{content:'✉';font:600 21px/1 sans-serif;}
body.server-authenticated #kvChatBtn .kv-support-label{display:none!important;}
body.server-authenticated #kvChatBtn #kvClientUnread{position:absolute;top:-4px;right:-5px;font:700 10px sans-serif;}
body.server-authenticated #kvChatPanel{bottom:74px!important;max-height:calc(100dvh - 94px)!important;}
body.server-authenticated #app{padding-bottom:75px!important;}
/* Optional icon rail on desktop: no routes or controls are removed. */
@media (min-width:761px){
 body.server-authenticated .app-shell.kv16-mini{grid-template-columns:var(--kv16-side-mini) minmax(0,1fr)!important;}
 body.server-authenticated .app-shell.kv16-mini>#sidebar{width:var(--kv16-side-mini)!important;padding-inline:7px!important;}
 body.server-authenticated .kv16-mini #sidebar .facility{padding:7px!important;justify-content:center;}
 body.server-authenticated .kv16-mini #sidebar .facility>div,body.server-authenticated .kv16-mini #sidebar .pulse-dot,body.server-authenticated .kv16-mini #sidebar .brand,body.server-authenticated .kv16-mini #sidebar .kv-find-pages,body.server-authenticated .kv16-mini #sidebar .sidebar-foot>div:nth-child(2),body.server-authenticated .kv16-mini #sidebar .sidebar-foot button,body.server-authenticated .kv16-mini #sidebar .build-badge {display:none!important;}
 body.server-authenticated .kv16-mini #sidebar #nav .kv-group-toggle{display:none!important;}
 body.server-authenticated .kv16-mini #sidebar #nav .kv-group-links,body.server-authenticated .kv16-mini #sidebar #nav .kv-group-links[hidden]{display:block!important;}
 body.server-authenticated .kv16-mini #sidebar #nav .kv-group-links>button[data-page]{justify-content:center!important;gap:0!important;padding:8px!important;font-size:0!important;min-height:39px!important;}
 body.server-authenticated .kv16-mini #sidebar #nav .kv-group-links>button[data-page] .ico{font-size:18px!important;flex-basis:21px!important;width:21px!important;}
 body.server-authenticated .kv16-mini #sidebar .sidebar-foot{justify-content:center!important;}
}
@media (max-width:1100px) and (min-width:761px){body.server-authenticated #mainContent>.topbar{gap:6px!important;}body.server-authenticated #mainContent>.topbar .system-heading{flex-basis:180px;}body.server-authenticated #mainContent>.topbar .top-actions{flex:1 1 100%;}}
@media(max-width:760px){
 body.server-authenticated .app-shell{display:block!important;max-width:100vw!important;}
 body.server-authenticated .app-shell>#sidebar{position:fixed!important;inset:0 auto 0 0!important;width:min(86vw,292px)!important;height:100dvh!important;max-height:100dvh!important;transform:translateX(-105%);transition:transform .22s ease!important;z-index:120!important;}
 body.server-authenticated .app-shell>#sidebar.open{transform:translateX(0)!important;}
 body.server-authenticated #sidebar #kv16Collapse{display:none!important;}
 body.server-authenticated #mainContent>.topbar{padding:9px 12px!important;display:grid!important;grid-template-columns:40px minmax(0,1fr)!important;gap:5px 8px!important;}
 body.server-authenticated #mainContent>.topbar #menuBtn{display:grid!important;grid-column:1;grid-row:1;}
 body.server-authenticated #mainContent>.topbar .system-heading{grid-column:2;grid-row:1;min-width:0!important;}
 body.server-authenticated #mainContent>.topbar .top-actions{grid-column:1/-1!important;grid-row:2;width:100%;min-width:0;justify-content:flex-start!important;display:flex!important;}
 body.server-authenticated #mainContent>.topbar .top-actions .search{display:none!important;}
 body.server-authenticated #app{padding:13px 11px 83px!important;}
 body.server-authenticated #kvChatBtn{right:12px!important;bottom:12px!important;}
}
@media(prefers-reduced-motion:reduce){body.server-authenticated .app-shell>#sidebar{transition:none!important;}}
