/* The same numbered groups are used by the host and both standalone menus. */
:is(#content-workspace-navigation, nav:has(> .pa-nav-section)) {
  counter-reset: nav-group;
  align-content: start;
  row-gap: 8px;
}
.pa-nav-section {
  min-width: 0;
  counter-increment: nav-group;
  counter-reset: nav-item;
  padding: 4px;
  border: 1px solid #dce5df;
  border-radius: 13px;
  background: #fff;
}
.pa-nav-section > .pa-nav-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 7px;
  color: #35483d;
  font: 700 14px/1.5 system-ui, sans-serif;
}
.pa-nav-title::before {
  content: counter(nav-group) / "";
  display: grid;
  flex: 0 0 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  color: #51665a;
  background: #edf2ef;
  font: 650 12px/1 system-ui, sans-serif;
}
.pa-nav-section:has(:is([aria-current="page"],.active)) > .pa-nav-title::before {
  color: #176334;
  background: #deeee2;
}
.pa-nav-items { display: grid; gap: 1px; }
:is(#content-workspace-navigation, nav) .pa-nav-items > button {
  counter-increment: nav-item;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #46594d;
  background: transparent;
  font: 500 14px/1.4 system-ui, sans-serif;
  text-align: left;
}
.pa-nav-items > button::before {
  content: counter(nav-group) "." counter(nav-item) / "";
  flex: 0 0 23px;
  color: #66786c;
  font: 500 11px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
:is(#content-workspace-navigation, nav) .pa-nav-title > button {
  flex: 1;
  min-height: 30px;
  padding: 3px 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
:is(#content-workspace-navigation, nav) .pa-nav-items > button:hover { background: #f3f7f4; }
:is(#content-workspace-navigation, nav) .pa-nav-items > button:is([aria-current="page"],.active) {
  border-color: #bddbc6;
  color: #165f32;
  background: #e9f5ed;
  box-shadow: none;
  font-weight: 700;
}
.pa-nav-items > button:is([aria-current="page"],.active)::before { color: #276b40; }
:is(#content-workspace-navigation, nav) .pa-nav-title > button:is(:hover,[aria-current="page"],.active) {
  color: #165f32;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
}
.pa-nav-section button:focus-visible { outline: 2px solid #26713d; outline-offset: -2px; }
aside:has(> nav .pa-nav-section) { overflow-y: auto; }
@media (max-width: 760px) {
  nav:has(.pa-nav-section) { align-items: center; }
  nav .pa-nav-section, nav .pa-nav-items { display: flex; flex: none; align-items: center; }
  nav .pa-nav-section { padding: 2px; }
  nav .pa-nav-section button, nav .pa-nav-title { flex: none; width: auto; white-space: nowrap; }
}

/* The host page and its embedded workspace share the same usable width. */
#workspace-menu-toggle { display:none; }
#shell > main { max-width:none; min-width:0; }
@media(min-width:901px) {
  #shell { --sidew:clamp(192px,15vw,226px); }
  #shell > aside { width:var(--sidew); }
  #shell.pa-home > main { padding-inline:clamp(20px,2.5vw,52px); }
  #shell #content-workspace-navigation { scrollbar-width:thin; }
}
@media(max-width:900px) {
  #shell { --pa-mobile-head:54px; flex-direction:column; }
  #shell > aside { position:fixed; inset:0 0 auto; z-index:30; display:flex; flex-flow:row nowrap;
    align-items:center; justify-content:space-between; width:100%; height:var(--pa-mobile-head);
    padding:0 14px; border:0; border-bottom:1px solid #dce6df; background:white; }
  #shell > aside > .brand { display:flex; margin:0; padding:0; font-size:17px; }
  #workspace-menu-toggle { display:block; padding:7px 12px; border:1px solid #cfddd3; border-radius:9px; background:#f1f7f2; color:#215b35; font:inherit; cursor:pointer; }
  #shell #content-workspace-navigation { display:none; }
  #shell.workspace-menu-open #content-workspace-navigation { display:grid; align-items:stretch; position:absolute; top:100%; right:8px;
    width:min(22rem,calc(100vw - 16px)); max-height:calc(100dvh - var(--pa-mobile-head) - 12px); overflow:auto;
    padding:10px; border:1px solid #d9e5dc; border-radius:12px; box-shadow:0 8px 24px #132e1c18; background:white; }
  #shell #content-workspace-frame { top:var(--pa-mobile-head); left:0; width:100%; height:calc(100dvh - var(--pa-mobile-head)); }
  #shell > main, #shell.pa-home > main { width:100%; padding:calc(var(--pa-mobile-head) + 16px) clamp(12px,3vw,24px) 30px; }
  #shell.pa-home #home > .g-21 { grid-template-columns:minmax(0,1fr); }
  #shell.pa-home #pa-personal-tools { float:none; margin:0 0 10px; }
  #shell.pa-home #pa-personal-tools summary { margin-left:0; }
}
@media(max-width:540px) {
  #shell .capture .capmeta { flex:1 0 100%; }
  #shell #homeStats { display:grid;grid-template-columns:repeat(2,minmax(0,1fr)); }
}

#shell, #content-workspace-navigation button, .pa-nav-section > .pa-nav-title {
  font-family: ui-rounded, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
#content-workspace-navigation .pa-nav-title { padding-block:6px; }
#content-workspace-navigation .pa-nav-section { border-radius:15px; }
#shell.pa-home #home :is(.capture,.card) { border-radius:18px; }

#shell #content-workspace-navigation .pa-nav-footer {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:12px 8px; border-top:1px solid #dce5df; font-size:12px; line-height:1.5;
}
#shell #content-workspace-navigation .pa-nav-footer small { display:inline; padding:0; font-size:inherit; }
.pa-nav-footer a { color:#176334; text-underline-offset:3px; }
@media(min-width:901px) {
  #shell > aside:has(#content-workspace-navigation) { display:flex; flex-direction:column; height:100dvh; box-sizing:border-box; }
  #shell #content-workspace-navigation { display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; }
  #shell .pa-nav-links { display:grid; align-content:start; gap:8px; flex:1; min-height:0; overflow:auto; scrollbar-width:thin; }
  #shell .pa-nav-footer { flex:none; }
}
@media(max-width:900px) { #shell .pa-nav-links { display:grid; gap:8px; } }

.workspace-back, #personal-assistant-entry button.workspace-back {
  display:inline-flex; align-items:center; min-height:38px; width:auto; padding:4px 10px;
  margin:0 0 8px -10px; border:0; border-radius:8px; background:transparent;
  color:#375b44; font-family:inherit; font-weight:600; font-size:14px; line-height:1.4; cursor:pointer;
}
.workspace-back[hidden] {display:none}
.workspace-back:hover, #personal-assistant-entry button.workspace-back:hover {background:#e9f3ec}
.workspace-back:focus-visible {outline:2px solid #247040}
