/* HBV R5.5-R3 adaptive admin shell closure.
   Purpose: independent sidebar scrolling, height-aware grouping, elegant compact mode,
   balanced topbar wrapping and content grids without altering business semantics. */
html[data-hbv-admin-r3="ready"]{
  --r3-sidebar:272px;
  --r3-sidebar-compact:84px;
  --r3-topbar-h:82px;
  --r3-canvas:#f3f7fc;
  --r3-surface:#fff;
  --r3-line:#d9e5f2;
  --r3-ink:#143250;
  --r3-muted:#73869c;
  --r3-blue:#1e6ef5;
  --r3-blue-soft:#eaf2ff;
  --r3-shadow:0 12px 34px rgba(21,48,83,.07);
  --r3-shadow-soft:0 7px 22px rgba(21,48,83,.045)
}
html[data-hbv-admin-r3="ready"],html[data-hbv-admin-r3="ready"] body{min-height:100%;background:var(--r3-canvas)}
html[data-hbv-admin-r3="ready"] body{overflow-x:hidden}

/* Stable desktop geometry: sidebar and content scroll independently. */
html[data-hbv-admin-r3="ready"] .admin-shell{display:block!important;min-height:100dvh}
html[data-hbv-admin-r3="ready"] .admin-sidebar{
  position:fixed!important;
  inset:0 auto 0 0!important;
  z-index:120!important;
  width:var(--r3-sidebar)!important;
  height:100dvh!important;
  min-height:0!important;
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
  padding:0!important;
  background:linear-gradient(180deg,#102b4b 0%,#0d213a 54%,#0b1c31 100%)!important;
  border-right:1px solid rgba(255,255,255,.055)!important;
  box-shadow:9px 0 30px rgba(8,27,49,.14)!important;
  transition:width .22s ease,transform .22s ease
}
html[data-hbv-admin-r3="ready"] .admin-main{
  min-width:0!important;
  width:auto!important;
  margin-left:var(--r3-sidebar)!important;
  transition:margin-left .22s ease
}
html[data-hbv-admin-r3="ready"] .admin-brand{
  position:relative;
  flex:0 0 auto;
  min-height:82px;
  padding:17px 48px 15px 17px!important;
  border-bottom:1px solid rgba(255,255,255,.075)!important;
  background:linear-gradient(180deg,rgba(255,255,255,.025),transparent)
}
html[data-hbv-admin-r3="ready"] .admin-brand-logo{width:38px;height:38px;flex:0 0 38px}
html[data-hbv-admin-r3="ready"] .admin-brand>div{min-width:0}
html[data-hbv-admin-r3="ready"] .admin-brand strong{display:block;overflow:hidden;text-overflow:ellipsis;font-size:13px!important;line-height:1.45;white-space:nowrap}
html[data-hbv-admin-r3="ready"] .admin-brand small{display:block;overflow:hidden;text-overflow:ellipsis;color:#9eb3ca!important;font-size:8.5px!important;letter-spacing:.07em;white-space:nowrap}
html[data-hbv-admin-r3="ready"] .r3-sidebar-toggle{
  position:absolute;right:12px;top:24px;width:30px;height:30px;display:grid;place-items:center;
  padding:0;border:1px solid rgba(255,255,255,.13);border-radius:10px;
  background:rgba(255,255,255,.06);color:#cfe0f3;cursor:pointer;transition:.16s ease
}
html[data-hbv-admin-r3="ready"] .r3-sidebar-toggle:hover{background:rgba(255,255,255,.12);color:#fff;transform:translateY(-1px)}
html[data-hbv-admin-r3="ready"] .r3-sidebar-toggle svg{width:16px;height:16px;transition:transform .22s ease}

html[data-hbv-admin-r3="ready"] .admin-nav-tools{flex:0 0 auto;padding:11px 14px 6px!important}
html[data-hbv-admin-r3="ready"] .admin-nav-search input{height:36px!important;padding-left:12px!important;padding-right:36px!important;border-radius:11px!important;background:rgba(255,255,255,.055)!important}
html[data-hbv-admin-r3="ready"] .admin-nav-search span{right:13px!important;top:8px!important}
html[data-hbv-admin-r3="ready"] .admin-nav{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding:4px 12px 14px!important;
  scroll-behavior:smooth
}
html[data-hbv-admin-r3="ready"] .admin-nav::-webkit-scrollbar{width:6px}
html[data-hbv-admin-r3="ready"] .admin-nav::-webkit-scrollbar-track{background:transparent}
html[data-hbv-admin-r3="ready"] .admin-nav::-webkit-scrollbar-thumb{border-radius:999px;background:rgba(174,201,230,.20)}
html[data-hbv-admin-r3="ready"] .admin-nav:hover::-webkit-scrollbar-thumb{background:rgba(174,201,230,.38)}
html[data-hbv-admin-r3="ready"] .admin-nav{scrollbar-width:thin;scrollbar-color:rgba(174,201,230,.28) transparent}
html[data-hbv-admin-r3="ready"] .admin-nav-group{
  position:relative;display:flex!important;align-items:center;justify-content:space-between;gap:8px;
  min-height:30px;margin:5px 2px 1px!important;padding:7px 9px!important;
  border:0;border-radius:9px;color:#7993ae!important;font-size:8.5px!important;font-weight:800;
  letter-spacing:.12em;cursor:pointer;user-select:none;outline:none
}
html[data-hbv-admin-r3="ready"] .admin-nav-group:hover,html[data-hbv-admin-r3="ready"] .admin-nav-group:focus-visible{background:rgba(255,255,255,.045);color:#abc0d6!important}
html[data-hbv-admin-r3="ready"] .admin-nav-group .r3-group-chevron{font-size:13px;line-height:1;transition:transform .18s ease}
html[data-hbv-admin-r3="ready"] .admin-nav-group[data-r3-collapsed="true"] .r3-group-chevron{transform:rotate(-90deg)}
html[data-hbv-admin-r3="ready"] .admin-nav button{
  position:relative;display:flex!important;align-items:center!important;gap:11px!important;
  min-height:39px!important;height:auto!important;margin:2px 0!important;padding:9px 11px!important;
  border-radius:10px!important;color:#c8d7e7!important;font-size:10.7px!important;line-height:1.3!important;
  white-space:normal!important;transition:background .15s ease,color .15s ease,transform .15s ease
}
html[data-hbv-admin-r3="ready"] .admin-nav button:hover{background:rgba(255,255,255,.07)!important;color:#fff!important;transform:none!important}
html[data-hbv-admin-r3="ready"] .admin-nav button.active{background:linear-gradient(90deg,#176bfe,#438bf8)!important;color:#fff!important;box-shadow:0 8px 20px rgba(23,107,254,.24)!important}
html[data-hbv-admin-r3="ready"] .admin-nav button.r3-group-hidden{display:none!important}
html[data-hbv-admin-r3="ready"] .admin-nav img{width:16px!important;height:16px!important;flex:0 0 16px}
html[data-hbv-admin-r3="ready"] .admin-sidebar-foot{
  flex:0 0 auto;margin:0!important;padding:10px 13px 13px!important;
  border-top:1px solid rgba(255,255,255,.075)!important;
  background:linear-gradient(180deg,rgba(12,31,53,.76),#0b1c31)
}
html[data-hbv-admin-r3="ready"] .admin-sidebar-foot button{min-height:34px!important;margin-top:5px!important;padding:7px 10px!important;border-radius:9px!important;font-size:9.5px!important}
html[data-hbv-admin-r3="ready"] .p4-sidebar-status{margin:0 0 5px;color:#91a8c1;font-size:8.5px;line-height:1.45}

/* Comfortable topbar: primary identity and actions may wrap without crowding. */
html[data-hbv-admin-r3="ready"] .admin-topbar{
  position:sticky!important;top:0!important;z-index:90!important;
  min-height:82px!important;height:auto!important;
  display:flex!important;align-items:center!important;justify-content:space-between!important;flex-wrap:wrap!important;
  gap:10px 18px!important;padding:11px 26px!important;
  border-bottom:1px solid #dfe8f2!important;background:rgba(255,255,255,.96)!important;
  box-shadow:0 5px 22px rgba(25,51,84,.045)!important;backdrop-filter:blur(16px)
}
html[data-hbv-admin-r3="ready"] .admin-topbar-left{min-width:230px;flex:1 1 300px;align-items:center!important}
html[data-hbv-admin-r3="ready"] .admin-topbar-left>div{min-width:0}
html[data-hbv-admin-r3="ready"] .admin-topbar h1{overflow:hidden;text-overflow:ellipsis;color:#143250!important;font-size:20px!important;line-height:1.25;white-space:nowrap}
html[data-hbv-admin-r3="ready"] .admin-breadcrumb{margin-top:4px;color:#7b8da2!important;font-size:10px!important}
html[data-hbv-admin-r3="ready"] .admin-topbar-right{
  min-width:0!important;flex:0 1 auto;display:flex!important;align-items:center!important;justify-content:flex-end!important;
  flex-wrap:wrap!important;gap:7px!important
}
html[data-hbv-admin-r3="ready"] .admin-quick-links{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
html[data-hbv-admin-r3="ready"] .admin-quick-links a,html[data-hbv-admin-r3="ready"] .admin-quick-links button,
html[data-hbv-admin-r3="ready"] .p4-top-action,html[data-hbv-admin-r3="ready"] .hf21-s5-command-trigger,
html[data-hbv-admin-r3="ready"] #admin-account-security{
  min-height:36px!important;height:36px!important;padding:0 11px!important;border-radius:10px!important;
  font-size:10px!important;white-space:nowrap
}
html[data-hbv-admin-r3="ready"] .hf21-s5-command-trigger{gap:9px!important}
html[data-hbv-admin-r3="ready"] .p4-icon-button{width:auto!important;min-width:36px!important}
html[data-hbv-admin-r3="ready"] .r3-density-button{display:inline-flex!important;align-items:center;gap:6px!important}
html[data-hbv-admin-r3="ready"] .r3-density-button .r3-density-glyph{font-size:15px;line-height:1;letter-spacing:-2px}
html[data-hbv-admin-r3="ready"] .admin-chip{min-height:34px;padding:7px 10px!important;font-size:9.5px!important;white-space:nowrap}
html[data-hbv-admin-r3="ready"] .admin-avatar{flex:0 0 36px}
html[data-hbv-admin-r3="ready"] .r3-top-more{position:relative;display:none}
html[data-hbv-admin-r3="ready"] .r3-top-more>summary{list-style:none;display:flex;align-items:center;justify-content:center;min-width:56px;height:36px;padding:0 10px;border:1px solid var(--r3-line);border-radius:10px;background:#fff;color:#4d637d;font-size:10px;font-weight:750;cursor:pointer}
html[data-hbv-admin-r3="ready"] .r3-top-more>summary::-webkit-details-marker{display:none}
html[data-hbv-admin-r3="ready"] .r3-top-more-menu{position:absolute;right:0;top:43px;z-index:180;display:grid;min-width:190px;padding:8px;border:1px solid var(--r3-line);border-radius:13px;background:#fff;box-shadow:0 18px 44px rgba(18,47,82,.16)}
html[data-hbv-admin-r3="ready"] .r3-top-more-menu a,html[data-hbv-admin-r3="ready"] .r3-top-more-menu button{display:flex;align-items:center;width:100%;min-height:38px;padding:0 11px;border:0;border-radius:9px;background:transparent;color:#38516d;text-decoration:none;font-size:10px;text-align:left;cursor:pointer}
html[data-hbv-admin-r3="ready"] .r3-top-more-menu :is(a,button):hover{background:#eef5ff;color:#195bba}

/* Content rhythm and balanced panels. */
html[data-hbv-admin-r3="ready"] .admin-content{width:100%!important;max-width:1820px!important;margin:0 auto!important;padding:24px 28px 76px!important}
html[data-hbv-admin-r3="ready"] .page-head{top:calc(var(--r3-topbar-h) + 8px)!important;align-items:center!important;box-shadow:var(--r3-shadow-soft)!important}
html[data-hbv-admin-r3="ready"] .hf21-s5-ops-context{grid-template-columns:minmax(260px,1.35fr) repeat(3,minmax(170px,.8fr));gap:10px;margin-bottom:18px;padding:11px;border-color:var(--r3-line);box-shadow:var(--r3-shadow-soft)}
html[data-hbv-admin-r3="ready"] .hf21-s5-ops-context>div{min-height:76px;padding:12px 14px}
html[data-hbv-admin-r3="ready"] .admin-command-strip{align-items:stretch}
html[data-hbv-admin-r3="ready"] .admin-grid,html[data-hbv-admin-r3="ready"] .admin-grid.equal{align-items:start!important}
html[data-hbv-admin-r3="ready"] .panel{align-self:start;box-shadow:var(--r3-shadow-soft)!important}
html[data-hbv-admin-r3="ready"] .panel-body{min-width:0}
html[data-hbv-admin-r3="ready"] .metric-grid{display:grid!important;gap:13px!important;align-items:stretch}
html[data-hbv-admin-r3="ready"] .metric-grid[data-r3-items="6"]{grid-template-columns:repeat(6,minmax(0,1fr))!important}
html[data-hbv-admin-r3="ready"] .metric-grid[data-r3-items="5"]{grid-template-columns:repeat(5,minmax(0,1fr))!important}
html[data-hbv-admin-r3="ready"] .metric-grid[data-r3-items="4"]{grid-template-columns:repeat(4,minmax(0,1fr))!important}
html[data-hbv-admin-r3="ready"] .metric-card{min-width:0!important;min-height:126px!important}
html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid{grid-template-columns:minmax(0,1.55fr) minmax(350px,.85fr)!important;grid-template-areas:"tasks review" "audits health"!important;align-items:start!important}
html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid>.panel:nth-child(1){grid-area:tasks!important}
html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid>.panel:nth-child(2){grid-area:review!important}
html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid>.panel:nth-child(3){grid-area:health!important}
html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid>.panel:nth-child(4){grid-area:audits!important}
html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid>.panel{grid-column:auto!important}
html[data-hbv-admin-r3="ready"] .table-wrap{scrollbar-width:thin;scrollbar-color:#b8c9dc transparent}
html[data-hbv-admin-r3="ready"] .table-wrap::-webkit-scrollbar{height:8px;width:8px}
html[data-hbv-admin-r3="ready"] .table-wrap::-webkit-scrollbar-thumb{border:2px solid transparent;border-radius:999px;background:#b8c9dc;background-clip:padding-box}

/* Elegant compact sidebar: not a mechanical drag rail. */
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-sidebar{width:var(--r3-sidebar-compact)!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-main{margin-left:var(--r3-sidebar-compact)!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-brand{justify-content:center;padding:17px 10px!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-brand>div{display:none}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-brand-logo{width:36px;height:36px}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .r3-sidebar-toggle{right:-13px;top:25px;background:#fff;color:#315776;border-color:#d3e0ed;box-shadow:0 6px 18px rgba(17,43,72,.12)}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .r3-sidebar-toggle svg{transform:rotate(180deg)}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-nav-tools,html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-nav-group{display:none!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-nav{padding:8px 10px 12px!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-nav button{justify-content:center!important;min-height:42px!important;padding:10px!important;font-size:0!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-nav button img{width:18px!important;height:18px!important;margin:0!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-nav button.active:after{display:none!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-sidebar-foot{padding:8px 10px 12px!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .p4-sidebar-status{display:none}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] .admin-sidebar-foot button{display:grid;place-items:center;height:38px;padding:0!important;font-size:0!important}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] #open-member-preview:before{content:"览";font-size:12px}
html[data-hbv-admin-r3="ready"][data-r3-sidebar="compact"] #admin-logout:before{content:"退";font-size:12px}

/* Height-aware mode: navigation groups are more compact but remain accessible. */
html[data-hbv-admin-r3="ready"][data-r3-height="short"] .admin-brand{min-height:68px;padding-top:12px!important;padding-bottom:10px!important}
html[data-hbv-admin-r3="ready"][data-r3-height="short"] .r3-sidebar-toggle{top:18px}
html[data-hbv-admin-r3="ready"][data-r3-height="short"] .admin-nav-tools{padding-top:7px!important}
html[data-hbv-admin-r3="ready"][data-r3-height="short"] .admin-nav-group{min-height:26px;margin-top:2px!important;padding-top:5px!important;padding-bottom:5px!important}
html[data-hbv-admin-r3="ready"][data-r3-height="short"] .admin-nav button{min-height:35px!important;padding-top:7px!important;padding-bottom:7px!important}
html[data-hbv-admin-r3="ready"][data-r3-height="short"] .admin-sidebar-foot button{min-height:31px!important}

@media(max-width:1650px){
  html[data-hbv-admin-r3="ready"] .admin-topbar-right{flex:1 1 680px}
  html[data-hbv-admin-r3="ready"] .admin-topbar{align-items:flex-start!important}
  html[data-hbv-admin-r3="ready"] .metric-grid[data-r3-items="6"]{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  html[data-hbv-admin-r3="ready"] .metric-grid[data-r3-items="5"]{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:1380px){
  html[data-hbv-admin-r3="ready"]{--r3-sidebar:242px}
  html[data-hbv-admin-r3="ready"] .admin-content{padding-left:22px!important;padding-right:22px!important}
  html[data-hbv-admin-r3="ready"] .admin-topbar{padding-left:21px!important;padding-right:21px!important}
  html[data-hbv-admin-r3="ready"] .admin-topbar [data-r3-priority="low"]{display:none!important}
  html[data-hbv-admin-r3="ready"] .r3-top-more{display:block}
  html[data-hbv-admin-r3="ready"] .hf21-s5-ops-context{grid-template-columns:1fr 1fr}
  html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid{grid-template-columns:minmax(0,1.35fr) minmax(320px,.8fr)!important}
}
@media(max-width:1120px){
  html[data-hbv-admin-r3="ready"]{--r3-sidebar:224px}
  html[data-hbv-admin-r3="ready"] .admin-topbar [data-r3-priority="medium"]{display:none!important}
  html[data-hbv-admin-r3="ready"] .metric-grid[data-r3-items]{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  html[data-hbv-admin-r3="ready"] #page-dashboard>.admin-grid{grid-template-columns:1fr!important;grid-template-areas:"tasks" "review" "health" "audits"!important}
}
@media(max-width:920px){
  html[data-hbv-admin-r3="ready"] .admin-sidebar{width:min(310px,86vw)!important;transform:translateX(-105%)}
  html[data-hbv-admin-r3="ready"] .admin-sidebar.open{transform:translateX(0)}
  html[data-hbv-admin-r3="ready"] .admin-main{margin-left:0!important}
  html[data-hbv-admin-r3="ready"] .r3-sidebar-toggle{display:none}
  html[data-hbv-admin-r3="ready"] .admin-topbar{min-height:68px!important;padding:9px 14px!important}
  html[data-hbv-admin-r3="ready"] .admin-topbar-right{flex:0 1 auto}
  html[data-hbv-admin-r3="ready"] .admin-content{padding:18px 14px 84px!important}
  html[data-hbv-admin-r3="ready"] .page-head{position:static!important}
  html[data-hbv-admin-r3="ready"] .hf21-s5-ops-context{grid-template-columns:1fr 1fr}
}
@media(max-width:680px){
  html[data-hbv-admin-r3="ready"] .admin-topbar-left{flex-basis:100%}
  html[data-hbv-admin-r3="ready"] .admin-topbar-right{width:100%;justify-content:flex-start!important}
  html[data-hbv-admin-r3="ready"] .admin-topbar-right>:not(.r3-top-more):not(.admin-avatar):not(#admin-account-security){display:none!important}
  html[data-hbv-admin-r3="ready"] .r3-top-more{display:block}
  html[data-hbv-admin-r3="ready"] .hf21-s5-ops-context{grid-template-columns:1fr}
  html[data-hbv-admin-r3="ready"] .metric-grid[data-r3-items]{grid-template-columns:1fr!important}
  html[data-hbv-admin-r3="ready"] .page-head{padding:15px!important}
}
@media(prefers-reduced-motion:reduce){html[data-hbv-admin-r3="ready"] .admin-sidebar,html[data-hbv-admin-r3="ready"] .admin-main,html[data-hbv-admin-r3="ready"] .r3-sidebar-toggle svg{transition:none!important}}
@media(forced-colors:active){html[data-hbv-admin-r3="ready"] .r3-sidebar-toggle,html[data-hbv-admin-r3="ready"] .r3-top-more>summary{border:1px solid CanvasText}}
@media print{html[data-hbv-admin-r3="ready"] .admin-sidebar,html[data-hbv-admin-r3="ready"] .admin-topbar{display:none!important}html[data-hbv-admin-r3="ready"] .admin-main{margin:0!important}html[data-hbv-admin-r3="ready"] .admin-content{max-width:none!important;padding:0!important}}
