:root:has(.workspace-shell) { scroll-padding-top: 48px; }
.workspace-shell {
  display: grid;
  grid-template: "header header" 48px "nav banner" auto "nav content" 1fr / var(--navigation-width) minmax(0, 1fr);
}
.site-header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, min(34vw, 384px)) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  height: 48px;
  padding-inline: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.public-shell .site-header { display: flex; justify-content: space-between; }
.shell-header-start, .shell-header-end { display: flex; align-items: center; gap: 6px; }
.shell-header-end { justify-content: end; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline-end: 6px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.brand strong { font-weight: 600; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--control-radius);
  color: var(--selected-text);
  background: var(--selected);
}
.shell-header-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  min-width: 32px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--control-radius);
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.shell-header-button:hover, .shell-disclosure[open] > summary.shell-header-button { background: var(--surface-sunken); }
.shell-search { min-width: 0; }
.search-trigger {
  display: flex;
  justify-content: start;
  width: 100%;
  padding-inline: 8px;
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
}
.search-trigger kbd { margin-inline-start: auto; }
.search-mobile-label { display: none; }
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-muted);
  background: var(--surface-sunken);
  font: 500 11px/17px Inter, sans-serif;
  text-align: center;
  white-space: nowrap;
}
.shell-disclosure { position: relative; }
.shell-disclosure > summary { list-style: none; }
.shell-disclosure > summary::-webkit-details-marker { display: none; }
.shell-new { height: 32px; min-height: 32px; }
.shell-popover {
  position: absolute;
  z-index: 7;
  inset: calc(100% + 8px) 0 auto auto;
  min-width: 148px;
  max-height: calc(100dvh - 56px);
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--card-radius);
  background: var(--surface);
}
.shell-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: var(--control-radius);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.shell-menu a:hover, .theme-choices button:hover { background: var(--surface-sunken); }
.shell-menu :is(a, button):focus-visible { outline-offset: -2px; }
.profile-trigger { padding: 0 2px; }
.profile-initials {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--selected-text);
  background: var(--selected);
  font-size: 12px;
  font-weight: 600;
}
.profile-menu { width: min(270px, calc(100vw - 24px)); padding: 6px; }
.profile-identity {
  display: flex;
  align-items: start;
  gap: 10px;
  margin-bottom: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.profile-identity .profile-initials { width: 36px; height: 36px; }
.profile-identity div > span { display: block; color: var(--ink-muted); font-size: 12px; }
.profile-menu hr { margin: 5px 6px; border: 0; border-top: 1px solid var(--line); }
.profile-theme { padding: 6px 8px; }
.profile-theme fieldset { margin: 0; padding: 0; border: 0; }
.profile-theme legend { padding: 0 0 4px; color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.theme-choices { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: var(--control-radius); }
.theme-choices button {
  flex: 1;
  min-height: 28px;
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}
.theme-choices button[aria-pressed="true"] { color: var(--selected-text); background: var(--selected); font-weight: 600; }
.notification-count {
  position: absolute;
  inset: 0 -3px auto auto;
  min-width: 16px;
  padding: 0 3px;
  border-radius: 100px;
  color: var(--danger-text);
  background: var(--danger-surface);
  font-size: 10px;
  font-weight: 600;
  line-height: 14px;
  text-align: center;
}

.environment-banner {
  grid-area: banner;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.navigation-slot {
  grid-area: nav;
  min-width: 0;
  border-inline-end: 1px solid var(--line);
  background: var(--surface);
}
.app-navigation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}
.navigation-slot .app-navigation {
  position: sticky;
  top: 48px;
  height: calc(100dvh - 48px);
  overflow-y: auto;
}
.nav-groups { display: grid; gap: 12px; }
.nav-group-heading, .shortcuts-section h2 {
  margin: 0 8px 4px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}
.nav-label { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.nav-count {
  padding: 0 6px;
  border-radius: 100px;
  color: var(--danger-text);
  background: var(--danger-surface);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
}
.nav-footer { margin-top: auto; }
.nav-footer, .shortcuts-section { padding-top: 12px; border-top: 1px solid var(--line); }
.nav-release { margin: 8px 8px 0; color: var(--ink-muted); font-size: 11px; }
.nav-release span:first-child { display: block; font-weight: 600; }

.mobile-menu-button, .mobile-inbox-link { display: none; }
.navigation-drawer .nav-shortcut-duplicate, :root[data-nav="sidebar"] .nav-shortcut-duplicate { display: none; }
.navigation-drawer .nav-group:not(:has(li:not(.nav-shortcut-duplicate))),
:root[data-nav="sidebar"] .nav-group:not(:has(li:not(.nav-shortcut-duplicate))) { display: none; }
:root[data-nav="rail"] .navigation-slot .app-navigation { padding-inline: 7px; overflow: visible; }
:root[data-nav="rail"] .navigation-slot :is(.nav-group-heading, .shortcuts-section, .nav-release) { display: none; }
:root[data-nav="rail"] .navigation-slot .nav-link { justify-content: center; }
:root[data-nav="rail"] .navigation-slot .nav-label {
  position: absolute;
  z-index: 3;
  inset: 50% auto auto calc(100% + 5px);
  width: max-content;
  max-width: 12rem;
  padding: 4px 8px;
  transform: translateY(-50%);
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  color: var(--ink);
  background: var(--surface);
  opacity: 0;
  pointer-events: none;
}
:root[data-nav="rail"] .navigation-slot .nav-label::before {
  position: absolute;
  inset: 0 100% 0 auto;
  width: 6px;
  content: "";
}
:root[data-nav="rail"] .navigation-slot .nav-link:is(:hover, :focus) .nav-label { opacity: 1; pointer-events: auto; }
:root[data-nav="rail"] .navigation-slot .nav-link[data-tooltip-dismissed] .nav-label { opacity: 0; pointer-events: none; }

:root[data-nav="top"] .workspace-shell {
  grid-template: "header" 48px "nav" auto "banner" auto "content" 1fr / minmax(0, 1fr);
}
:root[data-nav="top"] .navigation-slot { border-inline-end: 0; border-bottom: 1px solid var(--line); }
:root[data-nav="top"] .navigation-slot .app-navigation { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
:root[data-nav="top"] .navigation-slot :is(.nav-groups, .nav-list) { display: flex; flex-wrap: wrap; gap: 4px; }
:root[data-nav="top"] .navigation-slot :is(.nav-group-heading, .shortcuts-section) { display: none; }
:root[data-nav="top"] .navigation-slot .nav-list > li { margin: 0; }
:root[data-nav="top"] .navigation-slot .nav-footer { margin: 0 0 0 auto; padding: 0; border: 0; }
:root[data-nav="top"] .navigation-slot .nav-release { margin-top: 0; }

.navigation-drawer, .shell-dialog {
  color: var(--ink);
  background: var(--surface);
}
.navigation-drawer::backdrop, .shell-dialog::backdrop { background: var(--scrim); }
.navigation-drawer {
  inset: 0 auto 0 0;
  width: min(320px, 90%);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-inline-end: 1px solid var(--line-strong);
  --row-height: 40px;
}
.drawer-heading, .shell-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-heading { position: sticky; z-index: 2; top: 0; background: var(--surface); }
.navigation-drawer .app-navigation { min-height: calc(100dvh - 65px); }
.navigation-drawer .mobile-inbox-link { display: list-item; }

.shell-dialog {
  max-height: 75dvh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--card-radius);
}
.command-palette {
  inset: min(12vh, 96px) 0 auto;
  width: min(600px, calc(100% - 24px));
  margin: 0 auto;
}
.command-palette[open] { display: flex; flex-direction: column; }
.palette-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.palette-search input { min-width: 0; flex: 1; }
#palette-matches { overflow: auto; padding: 4px; }
.palette-group { padding-block: 4px; }
.palette-group p {
  padding: 0 8px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
}
.palette-group a {
  display: flex;
  align-items: center;
  gap: 6px 12px;
  flex-wrap: wrap;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: var(--control-radius);
  color: var(--ink);
  text-decoration: none;
}
.palette-group a:first-of-type { margin-top: 3px; }
.palette-group a:is(:hover, [aria-selected="true"]) { color: var(--selected-text); background: var(--selected); }
.palette-group a[aria-selected="true"] .muted { color: var(--selected-text); }
.palette-group a .muted { font-size: 12px; }
.palette-empty, .inbox-empty { padding: 12px; color: var(--ink-muted); }
.palette-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 12px;
}
.notification-panel { inset: 52px 16px auto auto; width: min(384px, calc(100% - 32px)); margin: 0; }
.notification-panel::backdrop { background: transparent; }
#notification-items > a { display: inline-block; margin: 12px; }
.inbox-list { margin: 0; padding: 0; list-style: none; }
.inbox-item {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
  padding: 10px 12px;
}
.inbox-item + .inbox-item { border-top: 1px solid var(--line); }
.inbox-entry { display: grid; justify-items: start; gap: 2px; min-width: 0; }
.inbox-open { min-height: 24px; overflow-wrap: anywhere; text-align: start; font-weight: 600; }
.inbox-entry span { font-size: 12px; }
.inbox-entry span:not(.inbox-unread) { color: var(--ink-muted); }
.inbox-unread { padding-inline: 5px; border-radius: 4px; color: var(--info-text); background: var(--info-surface); }
.inbox-mark { font-size: 12px; }
.shortcuts-dialog { width: min(470px, calc(100% - 24px)); }
.shortcut-keys { padding: 0 12px; }
.shortcut-keys div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; }
.shortcut-keys dd { margin: 0; white-space: nowrap; }

.record-breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 0; list-style: none; }
.record-breadcrumb .breadcrumb-current, .breadcrumb-separator { color: var(--ink-muted); }
.breadcrumb-separator { margin-inline-start: 8px; }
.detail-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }

@media (max-width: 640px) {
  .workspace-shell, :root[data-nav="top"] .workspace-shell {
    grid-template: "header" 48px "nav" auto "banner" auto "content" 1fr / minmax(0, 1fr);
  }
  .site-header { grid-template-columns: 1fr 1fr 1fr; padding-inline: 12px; }
  .shell-search { justify-self: center; }
  .search-trigger { justify-content: center; padding: 0; border-color: transparent; }
  .workspace-shell .brand, .search-label, .shell-search kbd, .shell-desktop-action, .nav-toggle { display: none; }
  .search-mobile-label { display: block; }
  .mobile-menu-button { display: inline-flex; }
  .has-drawer .navigation-slot { display: none; }
  .navigation-slot { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .navigation-slot .app-navigation { position: static; height: auto; --row-height: 40px; }
  .navigation-slot .mobile-inbox-link { display: list-item; }
  .command-palette { inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .command-palette .palette-footer { margin-top: auto; }
  .record-breadcrumb li:not(.breadcrumb-parent, .breadcrumb-current), .breadcrumb-separator { display: none; }
  .record-breadcrumb .breadcrumb-current {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
