/* Baria V1.4.44.54 — universal page base.
   IMPORTANT: this file does NOT own sidebar geometry or sidebar state.
   The only shell/sidebar authority is core/app-shell-v144454.css + .js.
*/
:root{
  --baria-page-bg:#f4faf7;
  --baria-panel-bg:#ffffff;
  --baria-border:#dfe9e5;
  --baria-radius:16px;
  --baria-control-h:44px;
  --baria-font:var(--w-font-family);
  --baria-gap:14px;
}
*{box-sizing:border-box}
html,body{min-height:100%;max-width:100%}
body{font-family:var(--w-font-family);background:var(--baria-page-bg);color:#17352d}

/* Legacy desktop sidebars are retired at source. Kept as a safety net only. */
.clinic-shell-sidebar,.baria-universal-sidebar{display:none!important}

/* One content frame. Width comes from the parent app-shell grid, never viewport math. */
.baria-page-frame{position:relative;z-index:1;width:100%;min-width:0;min-height:100vh;margin:0;padding:0;background:transparent;overflow:visible}
.baria-page-frame>.app-shell{display:block;width:100%;min-width:0;max-width:100%;margin:0;padding:0;grid-template-columns:none}
.baria-page-frame .main,.baria-page-frame main,.baria-page-frame .main-content,.baria-page-frame .clinic-main,.baria-page-frame .clinic-shell-main,.baria-page-frame .page-shell{width:100%;max-width:100%;min-width:0;box-sizing:border-box}
.baria-page-frame *{min-width:0}
.baria-page-frame img,.baria-page-frame svg,.baria-page-frame canvas,.baria-page-frame video{max-width:100%}
.baria-page-frame table{max-width:100%}
.baria-page-frame .table-wrap,.baria-page-frame .pp546-table-wrap{max-width:100%;overflow-x:auto}

/* Document-flow previous/next navigation. */
.baria-page-nav{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;margin:0 0 10px;position:relative;z-index:3;pointer-events:none}
.baria-page-nav__btn{pointer-events:auto;width:36px;height:36px;display:grid;place-items:center;border:1px solid #dbe8e3;border-radius:10px;background:#fff;color:#315b4e;text-decoration:none;box-shadow:0 3px 10px rgba(20,60,50,.045)}
.baria-page-nav__btn.is-disabled{opacity:.35;pointer-events:none}

/* Stable clinical surfaces; semantics and conditional logic remain module-owned. */
.baria-page-frame :is(.panel,.finding-card,.lab098-referral-card,.pp546-panel,.card,.section-card,.clinical-card){max-width:100%;border-color:var(--baria-border);border-radius:var(--baria-radius)}
.baria-page-frame :is(input:not([type=checkbox]):not([type=radio]),select,textarea){max-width:100%;box-sizing:border-box}
.baria-page-frame textarea{resize:vertical}
.baria-page-frame :is(.topbar,.toolbar,.endo-toolbar,.sono110-toolbar,.actions,.top-actions){max-width:100%;flex-wrap:wrap}
.baria-page-frame :is(.grid,.form-grid,.standardized-form-grid,.endo-grid,.sono-organ-boxes,.sono-organ-controls,.sono-detail-grid,.sono-alert-panel)>*{min-width:0}

/* Flex rows are allowed to reflow instead of clipping. */
.baria-page-frame :is(.topbar,.toolbar,.top-actions,.actions,.panel-head,.endo-toolbar,.endo-actions,.sono110-toolbar,.sono110-actions,.lab098-referral-head,.archive-row-head){flex-wrap:wrap}

/* Long strings and IDs never force the page under the sidebar. */
.baria-page-frame :is(p,li,small,label,.helper,.notice,.inline-note,.summary-kv b,.summary-kv span){overflow-wrap:anywhere}
.baria-page-frame :is(input,select,textarea,button,.btn){min-width:0}

/* Tables scroll inside their own surface; the app shell itself never hides overflow as a patch. */
.baria-page-frame .table-wrap,.baria-page-frame .pp546-table-wrap,.baria-page-frame .table-responsive{overflow-x:auto;overscroll-behavior-inline:contain}

/* Card rhythm independent of sidebar state. */
.baria-page-frame .panel,.baria-page-frame .card,.baria-page-frame .section-card{margin-bottom:14px}
.baria-page-frame .panel:last-child,.baria-page-frame .card:last-child,.baria-page-frame .section-card:last-child{margin-bottom:0}
.baria-page-end{margin-top:18px;padding:12px;text-align:center;color:#80958f;font-size:var(--w-text-small);border-top:1px solid #e1ece8}

/* Public pages keep compact content rhythm; no sidebar geometry here. */
.baria-page-frame .public-nav .container,.baria-page-frame .hero .container,.baria-page-frame .section .container{max-width:1320px;margin-inline:auto}
.baria-page-frame .public-nav .inner{min-height:62px}
.baria-page-frame .hero{padding:26px 0 36px}
.baria-page-frame .section{padding:40px 0}

@media(max-width:900px){
  .baria-page-frame .form-grid,.baria-page-frame .standardized-form-grid,.baria-page-frame .endo-grid.cols2,.baria-page-frame .endo-grid.cols3,.baria-page-frame .sono-organ-controls,.baria-page-frame .sono-detail-grid,.baria-page-frame .sono-alert-panel{grid-template-columns:1fr!important}
}
