.app-header {
  position: relative;
  z-index: 20;
  gap: 24px;
}

.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  box-shadow: 0 8px 24px #304c3d0a;
}

.nav-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 13px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.nav-tab:hover {
  color: var(--green);
  background: var(--mint);
  transform: translateY(-1px);
}

.nav-tab.is-active {
  color: white;
  background: var(--green);
  box-shadow: 0 7px 18px #1f6f5030;
}

.nav-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.desktop-logout {
  display: flex;
  margin-left: 3px;
}

.nav-avatar,
.mobile-avatar,
.mobile-user > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--orange), #c85e31);
  color: white;
  font-weight: 850;
  box-shadow: 0 6px 14px #e1774630;
}

.nav-avatar {
  padding: 0;
}

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

@media (max-width: 1080px) {
  body {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .shell {
    padding-top: max(20px, env(safe-area-inset-top));
  }

  .desktop-nav {
    display: none;
  }

  .mobile-menu {
    display: block;
    position: relative;
  }

  .mobile-menu summary {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 4px 7px 4px 4px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--paper);
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
    user-select: none;
  }

  .mobile-menu summary::-webkit-details-marker {
    display: none;
  }

  .mobile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .mobile-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 9px);
    width: min(280px, calc(100vw - 28px));
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    box-shadow: 0 20px 55px #27352d28;
    backdrop-filter: blur(16px);
  }

  .mobile-user {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 8px 13px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-user strong,
  .mobile-user small {
    display: block;
  }

  .mobile-user small {
    color: var(--muted);
  }

  .menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 10px 11px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    font: inherit;
    font-weight: 700;
  }

  .menu-link.is-active {
    color: var(--green);
    background: var(--mint);
  }

  .menu-link .nav-icon {
    width: 19px;
    height: 19px;
    color: var(--green);
  }

  .menu-logout {
    cursor: pointer;
    color: var(--red);
  }

  .logout-mark {
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    font-size: 20px;
    transform: rotate(45deg);
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 30;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    max-width: 620px;
    min-height: 66px;
    margin: 0 auto;
    padding: 6px;
    border: 1px solid #dfd8cc;
    border-radius: 22px;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    box-shadow: 0 18px 50px #27352d30;
    backdrop-filter: blur(18px);
  }

  .mobile-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    border-radius: 16px;
    color: var(--muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 760;
    transition: color .18s ease, background .18s ease, transform .18s ease;
  }

  .mobile-tab .nav-icon {
    width: 21px;
    height: 21px;
  }

  .mobile-tab.is-active {
    color: var(--green);
    background: var(--mint);
  }

  .mobile-tab.is-active::after {
    content: "";
    position: absolute;
    bottom: 3px;
    width: 16px;
    height: 3px;
    border-radius: 3px;
    background: var(--green);
  }

  .mobile-tab:active {
    transform: scale(.96);
  }
}

@media (max-width: 430px) {
  .app-header .brand {
    font-size: 23px;
  }

  .app-header .brand span {
    display: none;
  }

  .mobile-bottom-nav {
    left: max(7px, env(safe-area-inset-left));
    right: max(7px, env(safe-area-inset-right));
    gap: 1px;
    padding-inline: 4px;
  }

  .mobile-tab {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-tab,
  .mobile-tab {
    transition: none;
  }
}
