:root {
  --pwa-logia-nav-safe: calc(78px + env(safe-area-inset-bottom));
  --pwa-app-nav-safe: calc(76px + env(safe-area-inset-bottom));
}

.topbar .glsp-scope-badge,
.app-mobile-header .glsp-scope-badge {
  display: none !important;
}

.topbar .topbar-action-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.topbar .topbar-scope-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.topbar .topbar-scope-group .glsp-scope-toggle,
.app-mobile-scope-row .glsp-scope-toggle {
  min-width: 136px;
  max-width: 248px;
}

.topbar .topbar-scope-group .glsp-scope-toggle-text,
.app-mobile-scope-row .glsp-scope-toggle-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-mobile-header {
  display: grid;
  grid-template-rows: auto auto;
  gap: 0.45rem;
}

.app-mobile-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.app-mobile-actions-primary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.app-mobile-actions-primary .btn,
.app-mobile-actions-primary .dropdown .btn,
.app-mobile-actions-primary .btn-ghost {
  min-height: 38px;
}

.app-mobile-web-link {
  min-height: 38px;
  white-space: nowrap;
}

.app-mobile-scope-row {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.app-mobile-scope-row .glsp-scope-selector {
  width: 100%;
  justify-content: flex-end;
}

.cb-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.cb-results-summary {
  min-width: 0;
}

.cb-results-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.cb-results-page {
  white-space: nowrap;
}

.cb-view-mode-toggle .btn {
  min-width: 68px;
}

@media (max-width: 767.98px) {
  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-main-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-right {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-right .topbar-action-group {
    gap: 0.32rem;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-right > .btn,
  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-right > .dropdown .btn,
  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-right > .btn-ghost {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-context-row {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-end;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-context-row .topbar-scope-group {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-context-row .glsp-scope-toggle {
    height: 42px;
    min-width: 132px;
    max-width: min(72vw, 240px);
  }

  body.logia-mobile-host.logia-mobile-shell-active .content {
    padding-bottom: calc(var(--pwa-logia-nav-safe) + 1rem) !important;
    font-size: 0.94rem;
  }

  body.logia-mobile-host.logia-mobile-shell-active .content .card-body,
  .app-mobile-content .card-body,
  .app-mobile-content .app-card {
    padding: 0.8rem;
  }

  body.logia-mobile-host.logia-mobile-shell-active .content .page-title {
    font-size: 0.92rem;
  }

  body.logia-mobile-host.logia-mobile-shell-active .content .badge,
  .app-mobile-content .badge {
    font-size: 0.7rem;
  }

  .app-mobile-content {
    padding-bottom: calc(var(--pwa-app-nav-safe) + 0.85rem);
    font-size: 0.93rem;
  }

  .app-mobile-nav {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .cb-item {
    padding: 0.66rem;
  }

  .cb-tag {
    font-size: 0.68rem;
    padding: 0.2rem 0.45rem;
  }
}

@media (max-width: 390px) {
  .topbar .topbar-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    width: 100%;
  }

  .topbar .topbar-right .topbar-action-group {
    order: 1;
  }

  .topbar .topbar-right .topbar-scope-group {
    order: 2;
    width: 100%;
    justify-content: flex-end;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-main-row {
    grid-template-columns: 1fr;
    row-gap: 0.45rem;
  }

  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-right {
    justify-content: flex-start;
  }

  .topbar .topbar-scope-group .glsp-scope-toggle,
  .app-mobile-scope-row .glsp-scope-toggle {
    min-width: 124px;
    max-width: min(66vw, 214px);
  }

  .app-mobile-brand,
  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .page-title {
    font-size: 0.88rem;
  }

  .app-mobile-actions-primary,
  body.logia-mobile-host.logia-mobile-shell-active .topbar.topbar-logia-shell .topbar-right .topbar-action-group {
    gap: 0.28rem;
  }

  .app-mobile-web-link {
    font-size: 0.74rem;
    padding-inline: 0.45rem;
  }

  .cb-results-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
    align-items: start;
  }

  .cb-results-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.45rem;
  }

  .cb-results-page {
    font-size: 0.74rem;
  }

  .cb-view-mode-toggle {
    justify-self: end;
  }

  .cb-view-mode-toggle .btn {
    min-width: 64px;
    min-height: 34px;
    font-size: 0.74rem;
    padding: 0.24rem 0.5rem;
  }
}
