/* ── Mobile bottom navigation bar ───────────────────────────────────────── */
/* Hidden on desktop; replaces the hamburger sidebar pattern on ≤899px. */

.mobile-bottom-nav {
  display: none;
}

.mobile-nav-more {
  display: none;
}

@media (max-width: 899px) {
  /* ── Tab bar ──────────────────────────────────────────────────────── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-topbar, 180);
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    align-items: stretch;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
  }

  .mobile-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px 8px;
    color: var(--muted);
    text-decoration: none;
    background: transparent;
    border: none;
    font-family: inherit;
    cursor: pointer;
    transition: color .12s;
    position: relative;
    min-width: 0;
    min-height: 44px;
  }

  .mobile-bottom-nav__item:focus-visible {
    outline: 2px solid var(--color-primary, #0b5bff);
    outline-offset: -4px;
  }

  .mobile-bottom-nav__item.is-active {
    color: var(--color-primary);
  }

  .mobile-bottom-nav__item i {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
  }

  .mobile-bottom-nav__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .01em;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Active indicator dot above the icon */
  .mobile-bottom-nav__item.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--color-primary);
  }

  /* ── More sheet ───────────────────────────────────────────────────── */
  .mobile-nav-more {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal, 900) - 1);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
  }

  .mobile-nav-more.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-more__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 20, 0.52);
  }

  .mobile-nav-more__sheet {
    position: relative;
    z-index: 1;
    background: var(--surface-2);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--border);
    padding: 8px 16px calc(58px + env(safe-area-inset-bottom, 0px) + 16px);
    max-height: 80vh;
    overflow-y: auto;
  }

  .mobile-nav-more.is-open .mobile-nav-more__sheet {
    transform: none;
  }

  /* Drag handle visual */
  .mobile-nav-more__handle {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--border) 80%, transparent);
    margin: 0 auto 16px;
  }

  .mobile-nav-more__title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px;
  }

  .mobile-nav-more__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-nav-more__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--text);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    transition: background .12s, border-color .12s;
  }

  .mobile-nav-more__link.is-active {
    border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
    background: color-mix(in srgb, var(--color-primary) 8%, var(--surface-2));
    color: var(--color-primary);
  }

  .mobile-nav-more__link i {
    font-size: 20px;
    line-height: 1;
  }

  .mobile-nav-more__section { margin-top: 14px; }
}
