.has-app-shell .page {
  padding-top: calc(var(--safe-top) + 3.35rem);
}

.app-shell-topbar {
  position: fixed;
  top: calc(var(--safe-top) + 0.5rem);
  left: 0;
  right: 0;
  z-index: 85;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.85rem;
  pointer-events: none;
}

.app-shell-btn {
  pointer-events: auto;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.app-shell-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.app-shell-btn:active {
  transform: scale(0.95);
}

.app-shell-layer,
.app-shell-search-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.app-shell-backdrop,
.app-shell-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 20, 0.62);
  opacity: 0;
  transition: opacity 150ms ease;
}

.app-shell-drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(86vw, 22rem);
  max-width: 22rem;
  transform: translateX(-105%);
  transition: transform 180ms ease;
  background: #091426;
  border-right: 1px solid rgba(180, 202, 255, 0.18);
  color: #edf3ff;
  display: flex;
  flex-direction: column;
}

.app-shell-drawer-head {
  padding: calc(var(--safe-top) + 0.8rem) 0.9rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(173, 194, 245, 0.2);
}

.app-shell-drawer-head .identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.app-shell-drawer-head .avatar {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: var(--weight-bold);
  font-size: 0.84rem;
  color: #f8fbff;
}

#appShellAvatarImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-shell-drawer-head .meta {
  min-width: 0;
}

.app-shell-drawer-head .meta strong,
.app-shell-drawer-head .meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-drawer-head .meta strong {
  color: #f4f8ff;
}

.app-shell-drawer-head .meta small {
  color: #b8c7e6;
  font-size: 0.78rem;
}

.app-shell-close {
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(173, 194, 245, 0.32);
  background: rgba(255, 255, 255, 0.04);
  color: #dce8ff;
  font-size: 1.22rem;
  line-height: 1;
}

.app-shell-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 0.8rem calc(var(--safe-bottom) + 1rem);
}

.app-shell-section + .app-shell-section {
  margin-top: 1rem;
}

.app-shell-section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #c9d6f0;
}

.app-shell-link {
  width: 100%;
  border: 1px solid rgba(175, 198, 245, 0.2);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0.75rem;
  color: #f3f8ff;
  margin: 0 0 0.45rem;
  padding: 0.68rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.2;
}

.app-shell-link:active {
  transform: scale(0.99);
}

.app-shell-link-button {
  cursor: pointer;
}

.app-shell-badge {
  min-width: 1.25rem;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: var(--weight-bold);
  color: #fff;
  background: #ef4444;
  text-align: center;
}

.app-shell-search-panel {
  position: absolute;
  top: calc(var(--safe-top) + 0.6rem);
  left: 0.65rem;
  right: 0.65rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(177, 199, 245, 0.26);
  background: #101c31;
  color: #eef4ff;
  padding: 0.9rem;
  transform: translateY(-10px);
  opacity: 0;
  transition: transform 150ms ease, opacity 150ms ease;
}

.app-shell-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.app-shell-search-form {
  display: flex;
  gap: 0.5rem;
}

.app-shell-search-form input {
  flex: 1;
  border: 1px solid rgba(177, 199, 245, 0.35);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  color: #f4f8ff;
  padding: 0.62rem 0.72rem;
  font-size: 16px;
}

.app-shell-search-form button {
  border: 0;
  border-radius: 0.65rem;
  padding: 0.62rem 0.8rem;
  background: linear-gradient(90deg, #ec4899, #ef4444);
  color: #fff;
  font-weight: var(--weight-semibold);
}

.app-shell-search-scopes {
  margin-top: 0.65rem;
  display: flex;
  gap: 0.4rem;
}

.app-shell-search-scopes .scope-pill {
  border: 1px solid rgba(175, 198, 245, 0.3);
  background: rgba(255, 255, 255, 0.04);
  color: #d5e1f7;
  border-radius: 999px;
  padding: 0.32rem 0.66rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.app-shell-search-scopes .scope-pill.active {
  border-color: rgba(236, 72, 153, 0.7);
  color: #fff;
  background: linear-gradient(90deg, rgba(236, 72, 153, 0.32), rgba(239, 68, 68, 0.3));
}

.app-shell-search-results {
  margin-top: 0.7rem;
  max-height: min(44vh, 360px);
  overflow: auto;
  border: 1px solid rgba(175, 198, 245, 0.22);
  border-radius: 0.72rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.25rem 0;
}

.app-shell-search-results .hint {
  color: #cad7f2;
  padding: 0.65rem 0.75rem;
}

.app-shell-search-results .result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  color: #f4f8ff;
  border-bottom: 1px solid rgba(175, 198, 245, 0.14);
}

.app-shell-search-results .result-row:last-child {
  border-bottom: 0;
}

.app-shell-search-results .copy {
  min-width: 0;
}

.app-shell-search-results .copy strong,
.app-shell-search-results .copy small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell-search-results .copy small {
  color: #c5d4ef;
  margin-top: 2px;
}

.app-shell-search-results .arrow {
  color: #9db4df;
}

.app-shell-search-advanced {
  display: inline-flex;
  margin-top: 0.62rem;
  color: #c7d8fb;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.app-shell-menu-open,
body.app-shell-search-open {
  overflow: hidden;
}

body.app-shell-menu-open .app-shell-layer,
body.app-shell-search-open .app-shell-search-layer {
  pointer-events: auto;
}

body.app-shell-menu-open .app-shell-backdrop,
body.app-shell-search-open .app-shell-search-backdrop {
  opacity: 1;
}

body.app-shell-menu-open .app-shell-drawer {
  transform: translateX(0);
}

body.app-shell-search-open .app-shell-search-panel {
  transform: translateY(0);
  opacity: 1;
}

.tab-link {
  gap: 0.2rem;
}

.tab-link svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 2.2;
}

.tab-link .tab-profile-avatar {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.tab-link .tab-label {
  font-size: 0.64rem;
  line-height: 1;
}

.tab-link .tab-badge {
  position: absolute;
  top: 0.15rem;
  right: calc(50% - 0.95rem);
  min-width: 1rem;
  border-radius: 999px;
  padding: 0 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: #ef4444;
}

@media (max-width: 370px) {
  .tab-link .tab-label {
    display: none;
  }
  .tab-link .tab-badge {
    right: calc(50% - 0.75rem);
  }
}
