.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(15, 76, 129, 0.12);
  backdrop-filter: blur(18px) saturate(1.2);
}

.navbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.navbar .brand-logo {
  width: 34px;
  height: 34px;
  padding: 6px;
  object-fit: contain;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f4c81, #4fa3d9);
  box-shadow: 0 10px 20px rgba(15, 76, 129, 0.18);
}

.nav-menu-btn,
.nav-install,
.nav-update {
  flex: 0 0 auto;
}

.nav-menu-btn {
  display: none;
  border: 1px solid rgba(15, 76, 129, 0.18);
  background: #fff;
  color: #0f4c81;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  color: #475569;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 999px;
  position: relative;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(79, 163, 217, 0.12);
  color: #0f4c81;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
}

.nav-runtime-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff4e5;
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #fed7aa;
}

.nav-right .user {
  max-width: 20ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.nav-right .link {
  background: none;
  border: none;
  color: #0f4c81;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 700;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  margin-left: 6px;
}

.nav-link.nav-alert {
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.16);
}

.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.nav-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: min(88vw, 360px);
  height: 100%;
  background: #ffffff;
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.22);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.nav-drawer-kicker {
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.nav-drawer-links {
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow: auto;
}

.nav-drawer-link {
  color: #0f172a;
  text-decoration: none;
  padding: 14px 12px;
  border-radius: 14px;
  font-weight: 600;
}

.nav-drawer-link.active {
  background: #e0f2fe;
  color: #0f4c81;
}

.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 35;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.24);
}

.bottom-nav-link {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  text-align: center;
  padding: 11px 8px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
}

.bottom-nav-link.active {
  background: linear-gradient(135deg, #0f4c81, #4fa3d9);
  color: #fff;
}

body.nav-drawer-open {
  overflow: hidden;
}

body.nav-drawer-open .nav-drawer {
  pointer-events: auto;
}

body.nav-drawer-open .nav-drawer-backdrop {
  opacity: 1;
}

body.nav-drawer-open .nav-drawer-panel {
  transform: translateX(0);
}

html.device-mobile .nav-menu-btn,
html.device-tablet.viewport-compact .nav-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html.device-mobile .nav-links,
html.device-tablet.viewport-compact .nav-links {
  display: none;
}

html.device-mobile .nav-right .user,
html.device-tablet.viewport-compact .nav-right .user {
  display: none;
}

html.device-mobile .bottom-nav,
html.device-tablet.viewport-compact .bottom-nav {
  display: grid;
}

body.has-app-shell.device-mobile,
body.has-app-shell.device-tablet.viewport-compact {
  padding-bottom: 96px;
}

@media (max-width: 960px) {
  html.device-desktop .nav-menu-btn {
    display: none;
  }

  html.device-desktop .nav-links {
    display: flex;
  }

  html.device-desktop .nav-right .user {
    display: inline-block;
  }

  html.device-desktop .bottom-nav {
    display: none;
  }

  body.has-app-shell.device-desktop {
    padding-bottom: 0;
  }
}

@media (max-width: 960px) {
  .nav-menu-btn {
    display: none;
  }

  .nav-links { display: flex; }
  .nav-right .user { display: inline-block; }
  .bottom-nav { display: none; }
}

@media (min-width: 961px) {
  .nav-drawer {
    display: none;
  }
}
