.mlh-header {
  --mlh-frame-bg: linear-gradient(180deg, rgb(4 9 28 / 92%), rgb(6 12 32 / 86%));
  --mlh-border: rgb(106 96 255 / 70%);
  --mlh-border-soft: rgb(33 188 246 / 42%);
  --mlh-text: var(--app-text, #f8fbff);
  --mlh-muted: var(--app-muted, #aeb8d2);
  --mlh-glow-cyan: rgb(33 188 246 / 28%);
  --mlh-glow-violet: rgb(116 76 255 / 36%);
  --mlh-action-bg: rgb(11 18 42 / 76%);
  --mlh-action-border: rgb(176 190 224 / 24%);
  --mlh-primary: linear-gradient(135deg, #2cc7ff 0%, #6d57ff 48%, #8a3dff 100%);
  --mlh-radius: 22px;
  --mlh-hit: 44px;

  position: relative;
  z-index: 120;
  width: 100%;
  color: var(--mlh-text);
  font-family: var(--font-ui, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.mlh-header *,
.mlh-header *::before,
.mlh-header *::after {
  box-sizing: border-box;
}

.mlh-header-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--mlh-border);
  border-radius: var(--mlh-radius);
  background: var(--mlh-frame-bg);
  box-shadow:
    0 0 0 1px rgb(33 188 246 / 8%) inset,
    0 20px 60px rgb(0 0 0 / 32%),
    0 0 32px var(--mlh-glow-violet);
  backdrop-filter: blur(18px);
}

.mlh-header-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 0%, var(--mlh-glow-cyan), transparent 34%),
    radial-gradient(circle at 86% 14%, var(--mlh-glow-violet), transparent 30%);
  opacity: 0.65;
}

.mlh-main-row {
  position: relative;
  z-index: 1;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 22px;
}

.mlh-left,
.mlh-actions {
  min-width: 0;
  display: flex;
  align-items: center;
}

.mlh-left {
  flex: 0 0 var(--mlh-hit);
  justify-content: flex-start;
}

.mlh-back-as-page .mlh-left {
  flex: 0 0 auto;
}

.mlh-back-as-page .mlh-left > .page-back-link {
  min-height: 40px;
  margin-bottom: 0;
  padding: 0.55rem 0.92rem;
  border-radius: 12px;
  background: rgb(9 15 31 / 78%);
  border-color: rgb(170 190 255 / 18%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%);
}

.mlh-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
  gap: 14px;
}

.mlh-brand {
  min-width: 0;
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: min(40vw, 430px);
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.mlh-brand-text {
  min-width: 0;
  max-width: 100%;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  background: var(--ml-brand-gradient, linear-gradient(135deg, #29c788, #21bcf6, #2964f9, #a0a0fa));
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 16px var(--ml-brand-glow, rgb(33 188 246 / 22%)));
}

.mlh-brand-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  padding: 0 10px;
  border: 1px solid rgb(176 190 224 / 32%);
  border-radius: 999px;
  background: rgb(70 52 150 / 54%);
  box-shadow: 0 0 20px rgb(116 76 255 / 30%);
  color: #f8fbff;
  font-size: 0.76rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mlh-icon {
  width: 1.15em;
  height: 1.15em;
  display: block;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mlh-icon-link,
.mlh-account,
.mlh-pdf-link,
.mlh-level,
.mlh-auth-link,
.mlh-mobile-auth-link {
  -webkit-tap-highlight-color: transparent;
}

.mlh-icon-link,
.mlh-account {
  width: var(--mlh-hit);
  height: var(--mlh-hit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mlh-action-border);
  border-radius: 999px;
  background: var(--mlh-action-bg);
  color: #dce7ff;
  text-decoration: none;
  box-shadow: 0 10px 24px rgb(0 0 0 / 22%);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.mlh-pdf-link {
  min-height: var(--mlh-hit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgb(125 211 252 / 38%);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgb(14 116 144 / 34%), rgb(16 185 129 / 22%)),
    var(--mlh-action-bg);
  color: #ecfeff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 10px 24px rgb(8 47 73 / 28%);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.mlh-pdf-link__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
  color: #bae6fd;
}

.mlh-pdf-link__label {
  white-space: nowrap;
}

.mlh-level {
  min-width: 184px;
  min-height: var(--mlh-hit);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 6px 10px 6px 12px;
  border: 1px solid var(--mlh-action-border);
  border-radius: 999px;
  background: var(--mlh-action-bg);
  color: #f8fbff;
  text-decoration: none;
  box-shadow: 0 10px 24px rgb(0 0 0 / 22%);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.mlh-level-icon,
.mlh-level-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: #dce7ff;
}

.mlh-level-icon {
  width: 32px;
  height: 32px;
}

.mlh-level-text-block {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 3px;
  align-content: center;
}

.mlh-level-subtitle,
.mlh-level-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0;
}

.mlh-level-subtitle {
  color: var(--mlh-muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mlh-level-title {
  color: #fff;
  font-size: 0.94rem;
  font-weight: 900;
}

.mlh-level-chevron {
  width: 28px;
  height: 28px;
  background: rgb(255 255 255 / 7%);
}

.mlh-auth {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.mlh-auth-link {
  min-height: var(--mlh-hit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
  border: 1px solid var(--mlh-action-border);
  border-radius: 999px;
  background: var(--mlh-action-bg);
  color: #eef4ff;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: 0 10px 24px rgb(0 0 0 / 22%);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.mlh-auth-link-primary {
  min-width: 184px;
  border-color: rgb(139 92 246 / 72%);
  background: var(--mlh-primary);
  box-shadow:
    0 12px 30px rgb(107 87 255 / 28%),
    0 0 28px rgb(139 92 246 / 52%);
}

.mlh-mobile-auth {
  position: relative;
  z-index: 1;
  display: none;
}

.mlh-mobile-auth-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--mlh-action-border);
  border-radius: 14px;
  background: var(--mlh-action-bg);
  color: #eef4ff;
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
}

.mlh-mobile-auth-link-primary {
  border-color: rgb(33 188 246 / 58%);
  background: var(--mlh-primary);
  box-shadow:
    0 12px 28px rgb(33 188 246 / 28%),
    0 0 28px rgb(139 92 246 / 42%);
}

.mlh-mobile-auth-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mlh-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.mlh-icon-link:hover,
.mlh-icon-link:focus-visible,
.mlh-account:hover,
.mlh-account:focus-visible,
.mlh-level:hover,
.mlh-level:focus-visible,
.mlh-pdf-link:hover,
.mlh-pdf-link:focus-visible,
.mlh-auth-link:hover,
.mlh-auth-link:focus-visible,
.mlh-mobile-auth-link:hover,
.mlh-mobile-auth-link:focus-visible {
  border-color: var(--mlh-border-soft);
  background: rgb(18 28 62 / 90%);
  transform: translateY(-1px);
}

.mlh-auth-link-primary:hover,
.mlh-auth-link-primary:focus-visible,
.mlh-mobile-auth-link-primary:hover,
.mlh-mobile-auth-link-primary:focus-visible {
  background: linear-gradient(135deg, #34d2ff 0%, #6f63ff 48%, #9348ff 100%);
  box-shadow:
    0 14px 34px rgb(107 87 255 / 34%),
    0 0 32px rgb(139 92 246 / 58%);
}

.mlh-icon-link:focus-visible,
.mlh-account:focus-visible,
.mlh-pdf-link:focus-visible,
.mlh-level:focus-visible,
.mlh-auth-link:focus-visible,
.mlh-mobile-auth-link:focus-visible {
  outline: 3px solid rgb(33 188 246 / 34%);
  outline-offset: 3px;
}

@media (max-width: 1180px) {
  .mlh-header {
    --mlh-hit: 46px;
  }

  .mlh-main-row {
    min-height: 72px;
    gap: 14px;
    padding: 12px 18px 8px;
  }

  .mlh-brand-text {
    font-size: 1.78rem;
  }

  .mlh-auth {
    display: none;
  }

  .mlh-level {
    min-width: 172px;
  }

  .mlh-mobile-auth {
    grid-template-columns: minmax(0, 220px) minmax(0, 220px);
    justify-content: center;
    gap: 8px;
    padding: 7px 18px 14px;
  }

  .mlh-mobile-auth-visible .mlh-mobile-auth {
    display: grid;
  }
}

@media (max-width: 900px) {
  .mlh-header {
    --mlh-radius: 20px;
    --mlh-hit: 44px;

    z-index: 120;
  }

  .mlh-header-frame {
    border-color: rgb(108 86 255 / 82%);
    box-shadow:
      0 0 0 1px rgb(33 188 246 / 14%) inset,
      0 16px 46px rgb(0 0 0 / 32%),
      0 0 26px rgb(139 92 246 / 32%);
    backdrop-filter: blur(12px);
  }

  .mlh-main-row {
    min-height: 66px;
    gap: 10px;
    padding: 10px 16px 6px;
  }

  .mlh-brand {
    gap: 7px;
    max-width: min(40vw, 320px);
  }

  .mlh-brand-text {
    font-size: 1.58rem;
  }

  .mlh-brand-badge {
    min-height: 24px;
    padding-inline: 8px;
    font-size: 0.68rem;
  }

  .mlh-actions {
    gap: 0;
  }

  .mlh-auth {
    display: none;
  }

  .mlh-account {
    display: none;
  }

  .mlh-pdf-link {
    min-height: 42px;
    padding: 5px 10px;
  }

  .mlh-pdf-link__icon {
    width: 28px;
    height: 28px;
  }

  .mlh-level {
    min-width: 146px;
    min-height: 44px;
    padding: 5px 8px 5px 11px;
    gap: 7px;
  }

  .mlh-level-title {
    font-size: 0.94rem;
  }

  .mlh-level-subtitle {
    font-size: 0.62rem;
  }

  .mlh-level-icon {
    width: 30px;
    height: 30px;
  }

  .mlh-level-chevron {
    width: 28px;
    height: 28px;
  }

  .mlh-mobile-auth {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 7px 16px 12px;
  }
}

@media (max-width: 768px) {
  .mlh-level {
    min-width: 120px;
    min-height: 40px;
    padding: 5px 8px;
    gap: 6px;
  }

  .mlh-level-text-block {
    flex: 0 1 auto;
    display: block;
  }

  .mlh-level-subtitle {
    color: #eef4ff;
    font-size: 0.875rem;
    font-weight: 850;
    text-transform: none;
  }

  .mlh-level-title {
    display: none;
  }

  .mlh-level-icon {
    width: 28px;
    height: 28px;
  }

  .mlh-level-chevron {
    width: 22px;
    height: 22px;
  }

  .mlh-mobile-auth {
    gap: 8px;
    padding-inline: 16px;
  }
}

@media (max-width: 640px) {
  .mlh-header {
    --mlh-radius: 18px;
  }

  .mlh-main-row {
    min-height: 60px;
    padding: 8px 12px 5px;
  }

  .mlh-icon-link {
    width: 40px;
    height: 40px;
  }

  .mlh-brand-text {
    font-size: 1.34rem;
  }

  .mlh-brand-badge {
    display: none;
  }

  .mlh-level {
    min-width: 112px;
    min-height: 38px;
    padding: 4px 7px;
    gap: 4px;
  }

  .mlh-pdf-link__label {
    font-size: 0.82rem;
  }

  .mlh-level-title {
    font-size: 0.86rem;
  }

  .mlh-level-subtitle {
    font-size: 0.84rem;
  }

  .mlh-level-icon {
    width: 26px;
    height: 26px;
  }

  .mlh-level-chevron {
    width: 22px;
    height: 22px;
  }

  .mlh-mobile-auth {
    gap: 6px;
    padding: 5px 12px 10px;
  }

  .mlh-mobile-auth-link {
    min-height: 38px;
    border-radius: 12px;
    font-size: 0.84rem;
    padding-inline: 10px;
  }
}

@media (max-width: 555px) {
  .mlh-main-row {
    gap: 8px;
    padding-inline: 12px;
  }

  .mlh-no-back .mlh-main-row {
    justify-content: flex-start;
  }

  .mlh-no-back .mlh-left {
    display: none;
  }

  .mlh-brand {
    gap: 6px;
  }

  .mlh-no-back .mlh-brand {
    max-width: calc(100% - 96px);
  }

  .mlh-no-back .mlh-actions {
    margin-left: auto;
  }
}

@media (max-width: 480px) {
  .mlh-header-frame {
    border-radius: 17px;
  }

  .mlh-brand-text {
    font-size: 1.12rem;
  }

  .mlh-level {
    min-width: 110px;
  }

  .mlh-pdf-link {
    padding-inline: 8px;
    gap: 6px;
  }

  .mlh-mobile-auth {
    padding-inline: 10px;
  }
}

@media (max-width: 376px) {
  .mlh-brand-badge {
    display: none;
  }
}

@media (max-width: 370px) {
  .mlh-brand-text {
    font-size: 1rem;
  }

  .mlh-level {
    min-width: 102px;
    padding-inline: 5px;
  }

  .mlh-level-icon {
    display: inline-flex;
    width: 26px;
    height: 26px;
  }

  .mlh-level-chevron {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mlh-icon-link,
  .mlh-account,
  .mlh-level,
  .mlh-auth-link,
  .mlh-mobile-auth-link {
    transition: none;
  }
}
