html,
body {
  width: 100%;
  height: 100%;
}

body {
  --dock-expanded-size: 64px;
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--color-ink);
  background-color: var(--color-ink);
  font-size: 14px;
}

#left-panel {
  position: relative;
  z-index: 2;
  width: var(--dock-expanded-size);
  min-width: 0;
  min-height: 0;
  flex: 0 0 var(--dock-expanded-size);
  border-right: 1px solid var(--color-ink);
  background-color: var(--color-surface);
  transition: width 160ms ease, flex-basis 160ms ease;
}

#left-panel[data-collapsed="true"] {
  width: 0;
  flex-basis: 0;
  border-right: 0;
  background-color: transparent;
}

.dock-content {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  background-color: var(--color-surface);
}

#left-panel[data-collapsed="true"] .dock-content {
  display: none;
}

.dock-toggle-button {
  position: absolute;
  top: 50%;
  right: -22px;
  z-index: 4;
  display: flex;
  width: 44px;
  height: 44px;
  padding: 0;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  color: var(--color-surface);
}

.dock-toggle-tab {
  display: flex;
  width: 28px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-ink);
  border-radius: 0 16px 16px 0;
  background-color: var(--color-ink);
  box-shadow: 0 2px 6px rgb(58 58 58 / 24%);
}

.dock-toggle-icon {
  display: block;
  font-size: 24px;
  line-height: 1;
  transition: transform 160ms ease;
}

#left-panel[data-collapsed="true"] .dock-toggle-icon {
  transform: rotate(180deg);
}

@media (min-width: 48rem) {
  #left-panel[data-collapsed="true"] .dock-toggle-button {
    right: auto;
    left: 0;
    justify-content: flex-start;
  }
}

.app-list {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 0;
}

.app-list::before,
.app-list::after {
  min-width: 0;
  min-height: 0;
  flex: 1 0 0;
  content: "";
}

.scrollbar-custom {
  scrollbar-width: thin;
  scrollbar-color: var(--color-ink) var(--color-surface);
}

.scrollbar-custom::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scrollbar-custom::-webkit-scrollbar-track {
  background-color: var(--color-surface);
}

.scrollbar-custom::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background-color: var(--color-ink);
}

#right-panel {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background-color: var(--color-surface);
}

.workspace-pane {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.workspace-pane[data-help-resizing="true"] {
  pointer-events: none;
  user-select: none;
}

.workspace-pane[data-help-covered="true"] .workspace-status {
  visibility: hidden;
}

.appFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.appFrame[hidden] {
  display: none;
}

.workspace-status {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 3;
  display: flex;
  width: max-content;
  max-width: calc(100% - 32px);
  min-height: 44px;
  padding: 10px 12px;
  transform: translateX(-50%);
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--color-surface);
  color: var(--color-surface);
  background-color: var(--color-ink);
  box-shadow: 0 2px 8px rgb(58 58 58 / 24%);
}

.workspace-status[hidden],
.workspace-status-actions[hidden],
.loading-indicator[hidden] {
  display: none;
}

.workspace-status p {
  margin: 0;
  color: var(--color-surface);
  overflow-wrap: anywhere;
  text-align: center;
}

.loading-indicator {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid var(--color-surface);
  border-top-color: var(--color-action);
  border-radius: 50%;
  animation: workspace-loading 800ms linear infinite;
}

.workspace-status-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-status-actions button,
.workspace-status-actions a {
  display: inline-flex;
  min-height: 44px;
  padding: 8px 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-surface);
  color: var(--color-surface);
  background-color: var(--color-ink);
  text-align: center;
  text-decoration: none;
}

@keyframes workspace-loading {
  to {
    transform: rotate(360deg);
  }
}

.app-container {
  position: relative;
  width: 100%;
  flex: 0 0 56px;
}

.app-button {
  display: flex;
  width: 52px;
  height: 48px;
  margin: 4px auto;
  padding: 6px;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--color-ink);
  transition: transform 120ms ease, color 120ms ease, background-color 120ms ease;
}

.app-button svg {
  display: block;
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
  color: inherit;
}

.app-button.is-running {
  border-color: var(--color-ink);
  color: var(--color-ink);
  background-color: transparent;
}

.app-button.is-active {
  border-color: var(--color-ink);
  color: var(--color-action);
  background-color: var(--color-ink);
}

.app-label {
  border-left: 2px solid var(--color-identity);
  color: var(--color-ink);
  background-color: var(--color-surface);
  font-size: 14px;
}

.app-label {
  position: fixed;
  top: 8px;
  left: 72px;
  z-index: 5;
  display: flex;
  max-width: min(280px, calc(100vw - 16px));
  padding: 5px 8px;
  flex-direction: column;
  align-items: flex-start;
  visibility: hidden;
  pointer-events: none;
}

.app-label::before {
  position: absolute;
  top: 50%;
  left: -10px;
  width: 8px;
  height: 2px;
  transform: translateY(-50%);
  background-color: var(--color-action);
  content: "";
}

.app-label p {
  margin: 0;
  color: var(--color-ink);
  overflow-wrap: anywhere;
  text-align: left;
}

.app-button.is-caption-visible + .app-label,
.dock-help-button.is-caption-visible + .app-label,
.account-button.is-caption-visible + .app-label {
  visibility: visible;
}

#help-sidebar {
  --help-sidebar-width: 480px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  display: flex;
  width: var(--help-sidebar-width);
  height: 100%;
  min-width: 320px;
  min-height: 0;
  flex: 0 0 var(--help-sidebar-width);
  flex-direction: column;
  overflow: visible;
  color: var(--color-ink);
  background-color: var(--color-surface);
  box-shadow: -4px 0 14px rgb(58 58 58 / 24%);
}

#right-panel[data-help-pinned="true"] #help-sidebar {
  position: relative;
  z-index: 1;
  box-shadow: none;
}

#help-sidebar[hidden] {
  display: none;
}

.help-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -10px;
  z-index: 3;
  width: 20px;
  cursor: col-resize;
  touch-action: none;
}

.help-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 9px;
  width: 1px;
  background-color: var(--color-ink);
  content: "";
}

.help-resizer:focus-visible::after {
  width: 2px;
  background-color: var(--color-action);
}

.help-sidebar-header {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  flex-direction: column;
  border-bottom: 1px solid var(--color-ink);
  color: var(--color-surface);
  background-color: var(--color-ink);
}

.help-header-main {
  display: flex;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
}

.help-sidebar-header h1 {
  min-width: 0;
  margin: 0;
  padding: 8px 12px;
  color: var(--color-surface);
  font-size: 20px;
}

.help-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.help-pin-button,
.help-close-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 8px;
}

.help-pin-button svg,
.help-close-button svg {
  width: 28px;
  height: 28px;
}

.help-pin-button svg {
  transition: transform 120ms ease;
}

.help-pin-button[aria-pressed="true"] svg {
  transform: rotate(-45deg);
}

.help-close-button {
  margin-right: 4px;
}

.help-contents {
  position: relative;
  z-index: 2;
  height: 44px;
  flex: 0 0 44px;
  overflow: visible;
  border-bottom: 1px solid var(--color-ink);
  background-color: var(--color-surface);
}

.help-contents summary {
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

.help-contents nav {
  position: absolute;
  top: 44px;
  right: 0;
  left: 0;
  max-height: min(60vh, calc(100dvh - 140px));
  padding: 4px 12px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--color-ink);
  background-color: var(--color-surface);
  box-shadow: 0 6px 12px rgb(58 58 58 / 24%);
}

.help-contents:not([open]) nav {
  display: none;
}

.help-contents ul {
  margin: 0;
  padding-left: 14px;
  list-style: none;
}

.help-contents > nav > ul {
  padding-left: 0;
}

.help-contents li {
  position: relative;
  margin: 0;
  padding-left: 14px;
}

.help-contents li::before {
  position: absolute;
  top: 12px;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-ink);
  content: "";
}

.help-contents a {
  display: block;
  min-height: 28px;
  padding: 3px 2px;
  color: var(--color-ink);
  line-height: 22px;
  overflow-wrap: anywhere;
}

.help-contents a[aria-current="location"] {
  text-decoration-thickness: 2px;
  text-decoration-color: var(--color-action);
  font-weight: 700;
}

.help-document {
  min-width: 0;
  min-height: 0;
  padding: 16px 20px 48px;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: auto;
  color: var(--color-ink);
  background-color: var(--color-surface);
}

.help-app-section {
  width: 100%;
  max-width: none;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-ink);
}

.help-app-section + .help-app-section {
  padding-top: 24px;
}

.help-app-section:last-child {
  border-bottom: 0;
}

.help-app-section h2,
.help-topic-section h3,
.help-topic-section h4,
.help-topic-section h5,
.help-topic-section h6 {
  color: var(--color-ink);
  scroll-margin-top: 12px;
}

.help-app-section h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.help-app-section h2:focus,
.help-topic-section h3:focus,
.help-topic-section h4:focus,
.help-topic-section h5:focus,
.help-topic-section h6:focus {
  outline: 2px solid var(--color-action);
  outline-offset: 4px;
}

.help-topic-section {
  margin-left: 12px;
}

.help-topic-section h3,
.help-topic-section h4,
.help-topic-section h5,
.help-topic-section h6 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.help-topic-content {
  color: var(--color-ink);
  line-height: 1.5;
}

.help-topic-content p,
.help-topic-content ol,
.help-topic-content ul {
  margin-top: 0;
  margin-bottom: 1em;
}

.account {
  position: relative;
  display: flex;
  width: 100%;
  flex: 0 0 56px;
  align-items: center;
  justify-content: center;
}

.account-button {
  display: flex;
  width: 52px;
  height: 52px;
  padding: 4px;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease;
}

.circle {
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--color-ink);
}

#user-initial {
  color: var(--color-identity);
  font-size: 20px;
  transition: color 120ms ease;
  line-height: 1;
  text-align: center;
}

.account-button.is-active #user-initial {
  color: var(--color-action);
}

.separator {
  width: 100%;
  height: 0;
  margin: 2px 0;
  border: 0;
  border-top: 1px solid var(--color-ink);
}

.dock-help-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  flex: 0 0 52px;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  font-size: 22px;
  font-weight: 700;
  transition: transform 120ms ease, color 120ms ease, background-color 120ms ease;
}

.dock-help-button:disabled {
  opacity: 0.45;
}

@media (hover: hover) and (pointer: fine) {
  .app-button:hover {
    transform: scale(1.08);
  }

}

.app-button:active,
.dock-help-button:active,
.account-button:active {
  transform: scale(0.92);
}

@media (max-width: 47.999rem) {
  body {
    flex-direction: column;
  }

  #left-panel {
    order: 2;
    width: 100%;
    height: calc(var(--dock-expanded-size) + env(safe-area-inset-bottom));
    flex: 0 0 calc(var(--dock-expanded-size) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--color-ink);
    border-right: 0;
    transition: height 160ms ease, flex-basis 160ms ease;
  }

  #left-panel[data-collapsed="true"] {
    width: 100%;
    height: 0;
    flex-basis: 0;
    padding-bottom: 0;
    border-top: 0;
  }

  .dock-content {
    width: 100%;
    height: var(--dock-expanded-size);
    flex-direction: row;
  }

  .dock-toggle-button {
    top: -22px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .dock-toggle-tab {
    width: 32px;
    height: 28px;
    border-radius: 16px 16px 0 0;
  }

  .dock-toggle-icon {
    transform: rotate(-90deg);
  }

  #left-panel[data-collapsed="true"] .dock-toggle-button {
    top: -44px;
    align-items: flex-end;
  }

  #left-panel[data-collapsed="true"] .dock-toggle-icon {
    transform: rotate(90deg);
  }

  #right-panel {
    order: 1;
  }

  .account {
    width: 56px;
    flex: 0 0 56px;
  }

  .separator {
    width: 0;
    height: 100%;
    margin: 0 2px;
    border-top: 0;
    border-left: 1px solid var(--color-ink);
  }

  .app-list {
    width: auto;
    height: 100%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px;
  }

  .app-container {
    width: 56px;
    height: 100%;
    flex-basis: 56px;
  }

  .app-button {
    margin: 6px 2px;
  }

  .app-label {
    align-items: center;
    border-left: 0;
    border-bottom: 2px solid var(--color-identity);
  }

  .app-label::before {
    top: auto;
    bottom: -10px;
    left: 50%;
    width: 2px;
    height: 8px;
    transform: translateX(-50%);
  }

  .app-label p {
    text-align: center;
  }

  .dock-help-button {
    width: 52px;
    height: 100%;
    min-height: 44px;
    flex: 0 0 52px;
    border-top: 0;
    border-left: 0;
  }

  .workspace-status {
    top: 12px;
    width: calc(100% - 24px);
    max-width: 420px;
    flex-wrap: wrap;
  }

  .workspace-status-actions {
    width: 100%;
    justify-content: center;
  }

  #help-sidebar,
  #right-panel[data-help-pinned="true"] #help-sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 0;
    flex-basis: 100%;
    box-shadow: none;
  }

  .help-resizer,
  .help-pin-button {
    display: none;
  }

  .help-header-main {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
  }

  .help-contents nav {
    height: calc(100dvh - var(--dock-expanded-size) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 96px);
    max-height: none;
    overflow-y: scroll;
  }

  .help-document {
    padding: 14px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
  }
}

@media (prefers-reduced-motion: reduce) {
  #left-panel,
  .dock-toggle-icon,
  .app-button,
  .dock-help-button,
  .account-button,
  #user-initial,
  .help-pin-button svg {
    transition-duration: 0s;
  }

  .app-button:hover,
  .app-button:active,
  .dock-help-button:active,
  .account-button:active {
    transform: none;
  }

  .loading-indicator {
    animation: none;
  }
}
