.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 18, 25, 0.82);
  box-shadow: 0 8px 30px rgba(0, 8, 12, 0.18);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }

.logo a { display: inline-flex; align-items: center; gap: 0.7rem; color: #f4ffff; white-space: nowrap; }
.logo-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(140, 232, 227, 0.36);
  border-radius: 14px 14px 14px 5px;
  color: #052027;
  background: linear-gradient(145deg, var(--brand-bright), var(--brand));
  box-shadow: 0 8px 22px rgba(69, 208, 208, 0.18);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}
.logo-text { display: flex; flex-direction: column; font-size: 0.95rem; font-weight: 750; line-height: 1.1; letter-spacing: -0.02em; }
.logo-text::after { content: "Live flood intelligence"; margin-top: 0.25rem; color: var(--muted); font-size: 0.62rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }

.main-nav { display: flex; align-items: center; gap: 1rem; }
.nav-links, .user-nav { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
  position: relative;
  padding: 0.6rem 0.7rem;
  border-radius: 9px;
  color: #b9cdcf;
  font-size: 0.82rem;
  font-weight: 680;
  transition: color 150ms ease, background 150ms ease;
}
.nav-links a:hover, .nav-links a.is-active { color: #fff; background: rgba(139, 211, 218, 0.09); }
.nav-links a.is-active::after { content: ""; position: absolute; left: 0.7rem; right: 0.7rem; bottom: 0.25rem; height: 2px; border-radius: 9px; background: var(--brand); }
.nav-links a.nav-admin { color: #ffc8cb; }
.nav-links a.nav-admin:hover, .nav-links a.nav-admin.is-active { background: rgba(255, 107, 115, 0.1); }

.user-nav { padding-left: 0.8rem; border-left: 1px solid var(--line); }
.user-name { max-width: 130px; overflow: hidden; color: var(--muted); font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.user-nav .btn { min-height: 36px; padding: 0.5rem 0.75rem; font-size: 0.76rem; }

.nav-toggle { display: none; width: 42px; height: 42px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface-soft); cursor: pointer; }
.nav-toggle-bar { display: block; width: 20px; height: 2px; margin: 4px auto; border-radius: 9px; background: currentColor; transition: transform 160ms ease, opacity 160ms ease; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.admin-subnav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; padding: 0.65rem; border: 1px solid rgba(255, 107, 115, 0.18); border-radius: var(--radius); background: rgba(91, 19, 28, 0.16); }
.admin-subnav a { padding: 0.55rem 0.85rem; border-radius: 10px; color: #d9c5c7; font-size: 0.82rem; font-weight: 700; }
.admin-subnav a:hover, .admin-subnav a.is-active { color: #fff; background: rgba(255, 107, 115, 0.14); }

@media (max-width: 1040px) {
  .logo-text { font-size: 0.82rem; }
  .logo-text::after { display: none; }
  .nav-links a { padding-inline: 0.5rem; }
  .user-name { display: none; }
}

@media (max-width: 1120px) {
  .site-header { position: sticky; }
  .header-inner { min-height: 68px; }
  .nav-toggle { display: block; }
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0 14px;
    border-bottom: 1px solid transparent;
    background: rgba(4, 18, 25, 0.98);
    opacity: 0;
    transition: max-height 220ms ease, padding 220ms ease, opacity 160ms ease, visibility 0s linear 220ms;
  }
  .main-nav.nav-open { max-height: 540px; visibility: visible; padding-block: 0.75rem 1rem; border-bottom-color: var(--line); opacity: 1; transition: max-height 220ms ease, padding 220ms ease, opacity 160ms ease; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 0.2rem; }
  .nav-links a { min-height: 44px; padding: 0.75rem 0.8rem; font-size: 0.9rem; }
  .nav-links a.is-active::after { top: 0.7rem; bottom: 0.7rem; left: 0.25rem; right: auto; width: 3px; height: auto; }
  .user-nav { justify-content: flex-start; flex-wrap: wrap; padding: 0.75rem 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .user-nav .btn { min-height: 44px; }
}

@media (max-width: 390px) { .logo-text { max-width: 185px; white-space: normal; } }
