.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.brand-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
  text-decoration: none;
}

.logo-card {
  display: flex;
  align-items: center;
  width: auto;
  height: 49px;
  max-width: 42vw;
}

.logo-card img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-card .logo-dark {
  display: none;
}

html[data-theme="dark"] .logo-card .logo-light {
  display: none;
}

html[data-theme="dark"] .logo-card .logo-dark {
  display: block;
}

.brand-eyebrow {
  display: block;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 2px;
}

.page-title {
  display: block;
  color: var(--text);
  font-size: 28px;
  font-weight: 760;
  line-height: 1.08;
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-toggle,
.header-link {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .70);
  color: var(--muted-strong);
  box-shadow: 0 6px 18px rgba(30, 44, 39, .06);
}

html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .header-link {
  background: rgba(24, 33, 31, .80);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  padding: 0;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s, transform .2s;
}

.theme-toggle:hover,
.header-link:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.theme-toggle:focus-visible,
.header-link:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.theme-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.theme-toggle-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: flex;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}

.header-link:hover {
  transform: translateY(-1px);
}

.app-footer {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 24px;
}

.footer-disclaimer {
  max-width: 900px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.app-version {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.legal-links a {
  color: inherit;
  text-decoration: none;
  transition: color .2s;
}

.legal-links a:hover,
.legal-links a:focus-visible {
  color: var(--muted-strong);
}

.admin-footer-link {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  opacity: .72;
  text-decoration: none;
  transition: color .2s, opacity .2s;
}

.admin-footer-link:hover,
.admin-footer-link:focus-visible {
  color: var(--muted-strong);
  opacity: 1;
}

html[data-theme="dark"] .app-version {
  color: #84928e;
}

@media (max-width: 900px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .logo-card {
    height: 46px;
    max-width: 60vw;
  }
}

@media (max-width: 620px) {
  .brand-link {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .logo-card {
    height: 44px;
    max-width: 100%;
  }

  .page-title {
    font-size: 24px;
  }

  .header-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .header-link {
    width: 100%;
  }

  .theme-toggle {
    justify-self: start;
  }
}
