yd-shell {
  --yd-shell-field: var(--yd-space-2);
  box-sizing: border-box;
  container-type: inline-size;
  display: grid;
  width: 100%;

  grid-template-columns:
    var(--yd-shell-field) auto auto auto auto 1fr auto auto auto auto
    var(--yd-shell-field);
  grid-template-rows: minmax(var(--yd-shell-h), auto);
  align-items: center;
  column-gap: 0;
  min-height: var(--yd-shell-h);
  background: var(--yd-color-shell);
  color: var(--yd-color-shell-text);
  font-family: var(--yd-font-ui);
  font-size: var(--yd-text-md);
  line-height: var(--yd-leading-md);
  position: sticky;
  top: 0;
  z-index: var(--yd-z-shell);
}

@media (min-width: 768px) {
  yd-shell {
    --yd-shell-field: var(--yd-space-3);
  }
}

yd-shell *,
yd-shell *::before,
yd-shell *::after {
  box-sizing: border-box;
}

yd-shell:not(:defined) [data-js] {
  display: none;
}



yd-shell > [data-part='back'] {
  grid-column: 2;
}
yd-shell > [data-part='brand'] {
  grid-column: 3;
}
yd-shell > [data-part='apps'] {
  grid-column: 4;
}
yd-shell > [data-part='session'] {
  grid-column: 5;

  min-width: calc(var(--yd-space-2) * 4 + 40px + 5rem);
}
yd-shell > [slot='search'] {
  grid-column: 6;
  box-sizing: border-box;
  min-width: 14rem;

  max-width: 560px;
  padding: 0 var(--yd-space-3);
}
yd-shell > [slot='actions'] {
  grid-column: 7;
}
yd-shell > [data-part='context'] {
  grid-column: 8;
}
yd-shell > [data-part='bell'] {
  grid-column: 9;
}
yd-shell > [data-part='user'] {
  grid-column: 10;
}
yd-shell > :is([data-part], [slot='search'], [slot='actions']) {
  grid-row: 1;
}


yd-shell > [slot='tabs'] {
  grid-column: 1 / -1;
  grid-row: 3;
  min-height: var(--yd-shell-bar-h);
  padding: 0 var(--yd-space-3);
  overflow-x: auto;
  border-top: 1px solid var(--yd-color-shell-2);
}



.yd-shell__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.yd-shell__icon {
  flex: 0 0 auto;
}

.yd-shell__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

yd-shell :is(a, button, summary, input):focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--yd-focus-ring-shell);
}

yd-shell .yd-shell__panel :is(a, button, summary, input):focus-visible {
  box-shadow: var(--yd-focus-ring);
}



.yd-shell__brand {

  display: block;
  min-width: 0;
  min-height: var(--yd-tap-min);
  padding: 0 var(--yd-space-3);
  line-height: var(--yd-tap-min);
  overflow: hidden;
  color: var(--yd-color-shell-text);
  font-weight: var(--yd-weight-bold);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.yd-shell__brand {
  min-width: max-content;
}


.yd-shell__brand:hover,
.yd-shell__bell:hover {
  color: var(--yd-color-shell-text);
}

.yd-shell__back {
  display: inline-flex;
  align-items: center;
  gap: var(--yd-space-1);
  min-width: max-content;
  min-height: var(--yd-tap-min);
  padding: 0 var(--yd-space-2);
  color: var(--yd-color-shell-muted);
  text-decoration: none;
  border-radius: var(--yd-radius-md);
}

.yd-shell__back:hover {
  color: var(--yd-color-shell-text);
}



.yd-shell__apps {
  display: flex;
  align-items: center;
}

.yd-shell__apps-row {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yd-shell__apps-row li {
  display: flex;
  align-items: center;
  gap: var(--yd-space-1);
}

.yd-shell__app {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--yd-shell-h);
  padding: 0 var(--yd-space-3);
  color: var(--yd-color-shell-muted);
  text-decoration: none;
  white-space: nowrap;
}

a.yd-shell__app:hover {
  color: var(--yd-color-shell-text);
}


.yd-shell__app[aria-current='page'] {
  color: var(--yd-color-shell-text);
  font-weight: var(--yd-weight-bold);
}

.yd-shell__app[aria-current='page']::after {
  content: '';
  position: absolute;
  right: var(--yd-space-3);
  bottom: 0;
  left: var(--yd-space-3);
  height: 3px;
  background: var(--yd-color-shell-text);
}

.yd-shell__app--off {
  cursor: default;
}

.yd-shell__plan-note:hover {
  color: var(--yd-color-shell-text);
}

.yd-shell__plan-note {
  margin-left: calc(var(--yd-space-2) * -1);
  padding: var(--yd-space-1) var(--yd-space-2);
  color: var(--yd-color-shell-text);
  font-size: var(--yd-text-xs);
  white-space: nowrap;
}

@container (min-width: 1256px) {
  .yd-shell__apps-row {
    display: flex;
  }
  .yd-shell__apps-menu {
    display: none;
  }
}




.yd-shell__panel .yd-shell__app {
  min-height: var(--yd-control-h);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--yd-radius-md);
  color: var(--yd-color-text);
  text-overflow: ellipsis;
}

.yd-shell__panel .yd-shell__app--off {
  color: var(--yd-color-text-muted);
}

.yd-shell__panel a.yd-shell__app:hover {
  background: var(--yd-color-bg-muted);
  color: var(--yd-color-text);
}

.yd-shell__panel .yd-shell__app[aria-current='page']::after {
  background: var(--yd-color-accent);
}

.yd-shell__panel .yd-shell__plan-note,
.yd-shell__panel .yd-shell__plan-note:hover {
  margin-left: 0;
  color: var(--yd-color-text);
}

.yd-shell__menu {
  position: relative;
}

.yd-shell__menu > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--yd-space-2);
  min-width: var(--yd-tap-min);
  min-height: var(--yd-tap-min);
  padding: 0 var(--yd-space-2);
  border-radius: var(--yd-radius-md);
  color: var(--yd-color-shell-text);
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.yd-shell__menu > summary::-webkit-details-marker {
  display: none;
}

.yd-shell__menu > summary:hover,
.yd-shell__menu[open] > summary {
  background: var(--yd-color-shell-2);
}

.yd-shell__session > summary {
  max-width: 100%;
}

.yd-shell__session > summary .yd-shell__label {
  max-width: 12rem;
}

.yd-shell__chevron {
  transition: transform var(--yd-duration-fast) var(--yd-ease);
}

.yd-shell__menu[open] > summary .yd-shell__chevron {
  transform: rotate(180deg);
}

.yd-shell__panel {
  position: absolute;
  top: calc(100% + var(--yd-space-1));
  left: 0;
  z-index: var(--yd-z-dropdown);
  min-width: 15rem;
  max-width: calc(100vw - var(--yd-space-8));

  max-height: calc(100dvh - var(--yd-shell-h) * 3);
  padding: var(--yd-space-2);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--yd-color-border);
  border-radius: var(--yd-radius-lg);
  background: var(--yd-color-surface-raised);
  color: var(--yd-color-text);
  box-shadow: var(--yd-shadow-md);
  font-size: var(--yd-text-sm);
  line-height: var(--yd-leading-sm);
}

.yd-shell__menu[open] > .yd-shell__panel {
  animation: yd-shell-pop var(--yd-duration-fast) var(--yd-ease);
}

@keyframes yd-shell-pop {
  from {
    opacity: 0;
  }
}

.yd-shell__user > .yd-shell__panel {
  right: 0;
  left: auto;
}

.yd-shell__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.yd-shell__item {
  display: flex;
  align-items: center;
  gap: var(--yd-space-2);
  width: 100%;
  min-height: var(--yd-control-h);
  padding: 0 var(--yd-space-3);
  border: 0;
  border-radius: var(--yd-radius-md);
  background: transparent;
  color: var(--yd-color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

a.yd-shell__item:hover,
button.yd-shell__item:hover {
  background: var(--yd-color-bg-muted);
  color: var(--yd-color-text);
}

.yd-shell__item[aria-current] {
  background: var(--yd-color-accent-soft);
  font-weight: var(--yd-weight-medium);
}

.yd-shell__item-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yd-shell__item[aria-current] .yd-shell__muted {
  color: var(--yd-color-text-soft);
}

.yd-shell__muted {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--yd-color-text-muted);
  font-size: var(--yd-text-xs);
  font-feature-settings: var(--yd-font-ui-numeric);
}

.yd-shell__switch,
.yd-shell__logout,
.yd-shell__rename {
  margin: 0;
}

.yd-shell__actions,
.yd-shell__limits,
.yd-shell__theme,
.yd-shell__logout {
  margin-top: var(--yd-space-2);
  padding-top: var(--yd-space-2);
  border-top: 1px solid var(--yd-color-border);
}

.yd-shell__who {
  margin: 0;
  padding: var(--yd-space-2) var(--yd-space-3);
  color: var(--yd-color-text-soft);
  font-weight: var(--yd-weight-medium);
  overflow-wrap: anywhere;
}

.yd-shell__limits .yd-shell__list li {
  padding: var(--yd-space-1) var(--yd-space-3);
  color: var(--yd-color-text-muted);
}

.yd-shell__theme fieldset {
  min-width: 0;
  margin: 0;
  padding: 0 var(--yd-space-3);
  border: 0;
}

.yd-shell__theme legend {
  padding: 0;
  color: var(--yd-color-text-muted);
  font-size: var(--yd-text-xs);
}

.yd-shell__radio {
  display: flex;
  align-items: center;
  gap: var(--yd-space-2);
  min-height: var(--yd-control-h);
  cursor: pointer;
}

.yd-shell__rename {
  padding: var(--yd-space-1);
}

.yd-shell__input {
  width: 100%;
  min-height: var(--yd-control-h);
  padding: 0 var(--yd-space-2);
  border: 1px solid var(--yd-color-border-control);
  border-radius: var(--yd-radius-md);
  background: var(--yd-color-surface);
  color: var(--yd-color-text);
}



.yd-shell__count {
  flex: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--yd-space-1);
  border-radius: var(--yd-radius-full);
  background: var(--yd-color-shell-text);
  color: var(--yd-color-shell);
  font-size: var(--yd-text-xs);
  font-weight: var(--yd-weight-bold);
  font-feature-settings: var(--yd-font-ui-numeric);
  line-height: 1;
}

.yd-shell__context {
  display: inline-flex;
  align-items: center;
  gap: var(--yd-space-2);
  min-height: var(--yd-tap-min);
  padding: 0 var(--yd-space-3);
  border: 0;
  border-radius: var(--yd-radius-md);
  background: transparent;
  color: var(--yd-color-shell-text);
  font: inherit;
  cursor: pointer;
}

.yd-shell__context:hover {
  background: var(--yd-color-shell-2);
}

.yd-shell__bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--yd-space-1);
  min-width: var(--yd-tap-min);
  min-height: var(--yd-tap-min);
  padding: 0 var(--yd-space-2);
  border: 0;
  border-radius: var(--yd-radius-md);
  background: transparent;
  color: var(--yd-color-shell-text);
  font: inherit;
  text-decoration: none;
}


button.yd-shell__bell {
  cursor: pointer;
}

.yd-shell__bell:hover,
.yd-shell__bell[aria-expanded='true'] {
  background: var(--yd-color-shell-2);
}

.yd-shell__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--yd-radius-full);
  background: var(--yd-color-shell-2);
  color: var(--yd-color-shell-text);
  font-size: var(--yd-text-xs);
  font-weight: var(--yd-weight-bold);
}



.yd-search--shell {
  display: flex;
  align-items: center;
  gap: var(--yd-space-2);
  min-width: 0;
}


.yd-search.yd-search--shell {
  flex-wrap: nowrap;
}

.yd-search.yd-search--shell .yd-input {
  flex: 1 1 0;
}

.yd-search.yd-search--shell .yd-select {

  flex: 0 1 auto;
  max-width: 40%;
}

.yd-search--shell :is(input, select) {
  min-width: 0;

  border: 1px solid var(--yd-color-shell-muted);
  border-radius: var(--yd-radius-md);
  background: var(--yd-color-shell-2);
  color: var(--yd-color-shell-text);
}

.yd-search--shell input::placeholder {
  color: var(--yd-color-shell-muted);
}

.yd-search--shell :is(input, select):focus-visible {
  box-shadow: var(--yd-focus-ring-shell);
}




@container (max-width: 1279px) {
  .yd-shell__session > summary .yd-shell__label {
    max-width: 10rem;
  }
}


@container (max-width: 1023px) {
  .yd-shell__back > .yd-shell__label,
  .yd-shell__apps-menu > summary > .yd-shell__label,
  .yd-shell__context > .yd-shell__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .yd-shell__back,
  .yd-shell__apps-menu > summary,
  .yd-shell__context {
    justify-content: center;
    min-width: var(--yd-tap-min);
    padding: 0 var(--yd-space-2);
  }
}


@container (max-width: 825px) {
  yd-shell > [slot='search'] {
    grid-column: 2 / -2;
    grid-row: 2;
    min-width: 0;
    padding: 0 0 var(--yd-space-2);
  }

  yd-shell > [slot='actions'] {
    grid-column: 9 / -2;
    grid-row: 2;
    justify-self: end;
    margin-left: var(--yd-space-2);
    padding-bottom: var(--yd-space-2);
  }

  yd-shell > [slot='search']:has(~ [slot='actions']) {
    grid-column: 2 / 9;
  }


  yd-shell > :is([data-part='bell'], [data-part='user']) {
    justify-self: end;
  }
}

@container (max-width: 1455px) {
  yd-shell:has(> [data-part='back']) > [slot='search'] {
    grid-column: 2 / -2;
    grid-row: 2;
    min-width: 0;
    padding: 0 0 var(--yd-space-2);
  }

  yd-shell:has(> [data-part='back']) > [slot='actions'] {
    grid-column: 9 / -2;
    grid-row: 2;
    justify-self: end;
    margin-left: var(--yd-space-2);
    padding-bottom: var(--yd-space-2);
  }

  yd-shell:has(> [data-part='back']) > [slot='search']:has(~ [slot='actions']) {
    grid-column: 2 / 9;
  }

  yd-shell:has(> [data-part='back']) > :is([data-part='bell'], [data-part='user']) {
    justify-self: end;
  }
}

@container (max-width: 767px) {

  a.yd-shell__brand {
    min-width: 0;
    padding: 0 var(--yd-space-1);
  }

  yd-shell > [slot='tabs'] {
    padding: 0 var(--yd-space-2);
  }


  yd-shell > [slot='actions'],
  yd-shell:has(> [data-part='back']) > [slot='actions'] {
    grid-column: 8 / -2;
  }

  yd-shell > [slot='search']:has(~ [slot='actions']),
  yd-shell:has(> [data-part='back']) > [slot='search']:has(~ [slot='actions']) {
    grid-column: 2 / 8;
  }


  yd-shell > [data-part='session'] {
    min-width: var(--yd-tap-min);
  }


  .yd-shell__user > summary {
    padding: 0;
  }


  .yd-shell__context,
  .yd-shell__bell {
    position: relative;
    justify-content: center;
    min-width: var(--yd-tap-min);
    padding: 0 var(--yd-space-3);
  }

  .yd-shell__context > .yd-shell__count,
  .yd-shell__bell > .yd-shell__count {
    position: absolute;
    top: 2px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    outline: 2px solid var(--yd-color-shell);
  }


  .yd-shell__menu > summary > .yd-shell__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .yd-shell__menu > summary > .yd-shell__chevron {
    display: none;
  }

  .yd-shell__menu > summary {
    justify-content: center;
  }


  .yd-shell__menu {
    position: static;
  }

  .yd-shell__panel,
  .yd-shell__user > .yd-shell__panel {
    top: 100%;
    right: 0;
    left: 0;
    max-width: none;
    border-right: 0;
    border-left: 0;
    border-radius: 0 0 var(--yd-radius-lg) var(--yd-radius-lg);
  }

  .yd-shell__item,
  .yd-shell__radio,
  .yd-shell__panel .yd-shell__app {
    min-height: var(--yd-tap-min);
  }

  .yd-shell__plan-note {
    min-height: var(--yd-tap-min);
    display: inline-flex;
    align-items: center;
  }
}

@container (min-width: 768px) {
  .yd-shell__apps-menu > summary {
    padding: 0 var(--yd-space-3);
  }
}
