.app-shell {
  --app-global-width: 220px;
  --app-context-width: 244px;
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--wf-gray-50);
}
.app-global-nav {
  position: absolute;
  z-index: 60;
  inset: 0 auto 0 0;
  width: var(--app-global-width);
  display: flex;
  flex-direction: column;
  gap: var(--wf-space-4);
  padding: var(--wf-space-4) var(--wf-space-3);
  background: var(--wf-white);
  border-right: 1px solid var(--wf-border);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: var(--wf-space-3);
  margin: 0 var(--wf-space-1) var(--wf-space-1);
  color: var(--wf-text);
  font-size: var(--wf-text-sm);
  font-weight: 800;
  text-decoration: none;
}
.app-brand__mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--wf-radius-4);
  background: var(--wf-gray-700);
  color: var(--wf-white);
  font: 700 var(--wf-text-xs) var(--wf-font-mono);
  letter-spacing: .04em;
}
.app-global-links {
  min-height: 0;
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: var(--wf-space-1);
  overflow-y: auto;
  scrollbar-width: thin;
}
.app-global-divider { display: block; margin: var(--wf-space-3) var(--wf-space-1) var(--wf-space-1); border-top: 1px solid var(--wf-border); }
.app-global-label { padding: var(--wf-space-1) var(--wf-space-3) 2px; color: var(--wf-text-subtle); font-size: var(--wf-text-xs); font-weight: 800; letter-spacing: .09em; }
.app-global-link, .app-user-button {
  min-height: 34px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--wf-space-3);
  padding: var(--wf-space-2) var(--wf-space-3);
  border: 1px solid transparent;
  border-radius: var(--wf-radius-3);
  background: transparent;
  color: var(--wf-text-muted);
  font-size: var(--wf-text-md);
  font-weight: 700;
  text-decoration: none;
}
.app-global-link .wf-icon, .app-user-button .wf-icon { width: 17px; height: 17px; flex: 0 0 auto; }
.app-global-link:hover, .app-global-link[aria-current="page"], .app-user-button:hover, .app-user-button[aria-expanded="true"] {
  background: var(--wf-gray-100);
  color: var(--wf-text);
}
.app-global-link[aria-current="page"] { border-color: var(--wf-border-strong); }
.app-user { position: relative; margin-top: auto; }
.app-user-button { width: 100%; cursor: pointer; }
.app-user-popover {
  position: absolute;
  z-index: 80;
  left: calc(100% + var(--wf-space-3));
  bottom: 0;
  width: 220px;
  padding: var(--wf-space-2);
  border: 1px solid var(--wf-border-strong);
  border-radius: var(--wf-radius-4);
  background: var(--wf-white);
  box-shadow: var(--wf-shadow-2);
}
.app-user-popover[hidden] { display: none; }
.app-user-summary { padding: var(--wf-space-3); border-bottom: 1px solid var(--wf-border); }
.app-user-summary strong, .app-user-summary span { display: block; }
.app-user-summary span { color: var(--wf-text-muted); font-size: var(--wf-text-xs); }
.app-user-action {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: var(--wf-space-2);
  padding: 0 var(--wf-space-3);
  border: 0;
  border-radius: var(--wf-radius-2);
  background: transparent;
  color: var(--wf-text);
  text-align: left;
  text-decoration: none;
}
.app-user-action:hover { background: var(--wf-gray-100); }
.app-context-pane {
  position: absolute;
  z-index: 35;
  inset: 0 auto 0 var(--app-global-width);
  width: var(--app-context-width);
  overflow: auto;
  padding: var(--wf-space-4);
  background: var(--wf-white);
  border-right: 1px solid var(--wf-border);
  transition: transform var(--wf-motion-fast) var(--wf-motion-ease);
}
.app-shell[data-context-open="false"] .app-context-pane { transform: translateX(-100%); }
.app-header {
  position: absolute;
  z-index: 40;
  top: 0;
  right: 0;
  left: calc(var(--app-global-width) + var(--app-context-width));
  height: var(--wf-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wf-space-4);
  padding: 0 var(--wf-space-5);
  overflow: hidden;
  background: var(--wf-white);
  border-bottom: 1px solid var(--wf-border);
  transition: left var(--wf-motion-fast) var(--wf-motion-ease);
}
.app-shell[data-context-open="false"] .app-header { left: var(--app-global-width); }
.app-header__start, .app-header__end { display: flex; align-items: center; gap: var(--wf-space-3); min-width: 0; }
.app-header__end { margin-left: auto; }
.app-header__title { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.app-main {
  position: absolute;
  z-index: 1;
  inset: var(--wf-header-height) 0 0 calc(var(--app-global-width) + var(--app-context-width));
  overflow: auto;
  padding: var(--wf-space-6);
  background: var(--wf-gray-50);
  transition: left var(--wf-motion-fast) var(--wf-motion-ease);
}
.app-shell[data-context-open="false"] .app-main { left: var(--app-global-width); }
@media (max-width: 991.98px) {
  .app-shell { --app-global-width: 76px; --app-context-width: 260px; }
  .app-global-nav { padding: var(--wf-space-2); }
  .app-brand { justify-content: center; margin: 0 0 var(--wf-space-2); }
  .app-brand__label, .app-global-label, .app-global-divider, .app-global-link > span:last-child, .app-user-button > span:last-child { display: none; }
  .app-global-link, .app-user-button { min-height: 40px; justify-content: center; padding: var(--wf-space-1); }
  .app-global-link .wf-icon, .app-user-button .wf-icon { width: 20px; height: 20px; }
  .app-context-pane { top: var(--wf-header-height); box-shadow: var(--wf-shadow-2); }
  .app-header, .app-shell[data-context-open="false"] .app-header { left: var(--app-global-width); }
  .app-main, .app-shell[data-context-open="false"] .app-main { left: var(--app-global-width); padding: var(--wf-space-4); }
}
@media (max-width: 640px) {
  .app-shell { --app-global-width: 68px; }
  .app-global-link .wf-icon, .app-user-button .wf-icon { width: 22px; height: 22px; }
  .app-header { padding-inline: var(--wf-space-2); }
  .app-user-popover { position: fixed; left: calc(var(--app-global-width) + 8px); bottom: 12px; width: min(250px, calc(100vw - var(--app-global-width) - 20px)); }
}
