.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding-block: 0.375rem;
}

@media (max-width: 767px) {
  :root { --header-h: 4.25rem; }

  .header-logo-uk { font-size: 0.9375rem; }

  .header-logo .brand-en { font-size: 0.6875rem; }

  .header-logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .header-logo-icon {
    width: 2.125rem;
    height: 2.125rem;
  }
}

@media (min-width: 768px) {
  .header-logo .brand-en { font-size: 0.875rem; }
}

@media (min-width: 1024px) {
  .header-logo-uk { font-size: 1.125rem; }

  .header-logo .brand-en { font-size: 0.9375rem; }
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  min-width: 0;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.header-logo-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.header-logo-uk {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--text);
}

.header-logo .brand-en {
  font-size: 0.8125rem;
  margin-top: 0.0625rem;
}

.header-logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.header-nav {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.header-nav a {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
  background: rgb(149 184 162 / 0.12);
  color: var(--calm-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-role-badge {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.3125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

.header-role-badge[data-role="parent"] {
  background: rgb(149 184 162 / 0.14);
  border-color: rgb(149 184 162 / 0.35);
  color: var(--calm-dark);
}

.header-role-badge[data-role="nanny"] {
  background: rgb(100 149 237 / 0.1);
  border-color: rgb(100 149 237 / 0.28);
  color: #3b5998;
}

.header-role-badge[data-role="admin"] {
  background: rgb(120 90 180 / 0.12);
  border-color: rgb(120 90 180 / 0.28);
  color: #5a4a78;
}

.header-role-badge[data-role="guest"] {
  background: rgb(0 0 0 / 0.03);
}

.header-role-badge--mobile {
  display: block;
  width: fit-content;
  margin-bottom: 0.75rem;
}

.header-register-btn {
  display: none;
}

.header-search-btn { display: none; }

.header-burger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.375rem;
}

.header-burger:hover { background: rgb(0 0 0 / 0.04); }

@media (min-width: 768px) {
  .header-nav { display: flex; }
  .header-burger { display: none; }
  .header-search-btn { display: inline-flex; }
  .header-role-badge:not(.header-role-badge--mobile) { display: inline-flex; }
  .header-register-btn:not([hidden]) { display: inline-flex; }
}

.header-mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(0 0 0 / 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.header-mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.header-mobile-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(100%, 20rem);
  height: 100%;
  background: var(--white);
  padding: 1.25rem;
  padding-top: calc(1.25rem + env(safe-area-inset-top));
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.header-mobile-menu.open .header-mobile-panel {
  transform: translateX(0);
}

.header-mobile-link {
  display: block;
  padding: 0.875rem 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  min-height: var(--touch);
  line-height: var(--touch);
}

.header-mobile-link:hover { background: var(--bg); }

.header-mobile-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 1024px) {
  .header-cabinet-btn { display: inline-flex; }
  .header-register-btn:not([hidden]) { display: inline-flex; }
}

@media (max-width: 1023px) {
  .header-cabinet-btn { display: none; }
  .header-logout-btn:not(#logout-btn-mobile) { display: none; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .header-logout-btn:not(#logout-btn-mobile):not([hidden]) { display: inline-flex; }
}

/* ── Header action polish ── */

.header-role-badge {
  cursor: default;
  position: relative;
}

.header-role-badge[data-role="admin"] {
  background: rgb(100 70 180 / 0.09);
  border-color: rgb(100 70 180 / 0.28);
  color: #5438a8;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6875rem;
  box-shadow: 0 0 0 3px rgb(100 70 180 / 0.06);
}

.header-role-badge[data-role="admin"]::before {
  content: "⚙\00a0";
  font-size: 0.75em;
  opacity: 0.7;
}

.header-search-btn {
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 12px rgb(85 125 104 / 0.3);
  padding-inline: 1.375rem;
}

.header-search-btn:hover {
  box-shadow: 0 6px 20px rgb(85 125 104 / 0.4);
}

.header-logout-btn {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-color: rgb(0 0 0 / 0.1);
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.header-logout-btn::after {
  content: "\00a0→";
  opacity: 0.5;
  font-size: 0.9em;
}

.header-logout-btn:hover {
  background: rgb(239 68 68 / 0.05);
  border-color: rgb(239 68 68 / 0.2);
  color: #b91c1c;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.04);
}

.header-cabinet-btn {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-color: rgb(0 0 0 / 0.1);
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.header-cabinet-btn:hover {
  background: var(--white);
  border-color: rgb(0 0 0 / 0.16);
  color: var(--text);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.06);
}
