.app-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 0 18px;
  padding: 18px 22px 18px;
  border: 2px solid #9eb39d;
  border-radius: 24px;
  background: linear-gradient(160deg, #e4e8da 0%, #dde4d8 100%);
}

main.app-shell {
  max-width: 1320px !important;
  margin: 24px auto 0 !important;
  padding: 0 16px 40px !important;
}

.app-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.app-brand {
  margin: 0;
  min-width: 0;
}

.app-brand a {
  text-decoration: none;
  color: #081b10;
  font-size: clamp(2rem, 3.2vw, 3.3rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.app-subtitle {
  margin: 10px 0 0;
  color: #35513f;
  font-size: clamp(1rem, 1.35vw, 1.5rem);
  line-height: 1.25;
  font-weight: 500;
}

.app-header-top-right {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.app-header .meta {
  margin: 0;
  color: #35513f;
  font-size: clamp(0.95rem, 1.05vw, 1.15rem);
  line-height: 1.25;
}

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

.app-header .menu {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
}

.app-header .menu > #menu-render,
.app-header .menu > #menu-clip-library,
.app-header .menu > #menu-enhance-history,
.app-header .menu > #menu-history {
  display: none !important;
}

.app-header .menu-link,
.app-header .menu-dropdown-button,
.app-header .app-header-user-button,
.app-header .app-header-icon-link,
.app-header .menu-dropdown-panel a {
  all: unset;
  box-sizing: border-box;
}

.app-header .menu-link,
.app-header .menu-dropdown-button,
.app-header .app-header-user-button,
.app-header .app-header-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 15px;
  border-radius: 999px;
  background: #1f5337;
  color: #fff;
  font-size: clamp(0.95rem, 1vw, 1.08rem);
  font-weight: 800;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 0 rgba(10, 35, 20, 0.08);
  cursor: pointer;
  text-decoration: none;
}

.app-header .menu-link:hover,
.app-header .menu-dropdown-button:hover,
.app-header .app-header-user-button:hover,
.app-header .app-header-icon-link:hover {
  background: #245e3f;
}

.app-header .menu-link.active,
.app-header .menu-dropdown.active > .menu-dropdown-button,
.app-header .app-header-user.active > .app-header-user-button,
.app-header .app-header-icon-link.active {
  background: #18442d;
  box-shadow: 0 0 0 2px rgba(24, 68, 45, 0.18);
}

.app-header .menu-dropdown,
.app-header .app-header-user {
  position: relative;
}

.app-header .menu-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(21, 48, 31, 0.18);
  border-radius: 16px;
  background: #f8fbf5;
  box-shadow: 0 16px 32px rgba(13, 27, 19, 0.16);
  z-index: 60;
}

.app-header .menu-dropdown.is-open > .menu-dropdown-panel,
.app-header .app-header-user.is-open > .menu-dropdown-panel {
  display: flex;
}

.app-header .menu-dropdown.align-right > .menu-dropdown-panel,
.app-header .app-header-user.align-right > .menu-dropdown-panel {
  left: auto;
  right: 0;
}

.app-header .menu-dropdown-panel a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  color: #173122;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid rgba(31, 83, 55, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.app-header .menu-dropdown-panel a:hover,
.app-header .menu-dropdown-panel a:focus-visible {
  background: #edf6ef;
  outline: none;
}

.app-header .menu-dropdown-panel a.active {
  background: #e2efe4;
  border-color: rgba(24, 68, 45, 0.24);
}

.app-header .menu-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.16s ease;
  flex: 0 0 auto;
}

.app-header .menu-dropdown.is-open > .menu-dropdown-button .menu-caret,
.app-header .app-header-user.is-open > .app-header-user-button .menu-caret {
  transform: rotate(225deg) translateY(-1px);
}

.app-header .app-header-icon-link {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

.app-header .app-header-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

.app-header .app-header-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #c03939;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #e4e8da;
}

.app-header .app-header-badge.has-items {
  display: inline-flex;
}

.app-header .app-header-user-button {
  max-width: 220px;
  justify-content: space-between;
  padding-inline: 14px 12px;
}

.app-header .menu-user-name {
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 840px) {
  main.app-shell {
    margin-top: 18px !important;
    padding: 0 14px 32px !important;
  }

  .app-header {
    padding: 14px 14px 16px;
    gap: 12px;
    border-radius: 18px;
  }

  .app-header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .app-header-top-right {
    width: 100%;
    align-items: stretch;
    gap: 8px;
  }

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

  .app-brand a {
    font-size: 1.65rem;
  }

  .app-subtitle {
    margin-top: 8px;
    font-size: 0.98rem;
  }

  .app-header .meta {
    font-size: 0.95rem;
  }

  .app-header .menu-link,
  .app-header .menu-dropdown-button,
  .app-header .app-header-user-button,
  .app-header .app-header-icon-link {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 0.92rem;
  }

  .app-header .app-header-icon-link {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .app-header .app-header-user-button {
    max-width: none;
  }

  .app-header .menu-user-name {
    max-width: none;
  }

  .app-header .menu-dropdown-panel,
  .app-header .menu-dropdown.align-right > .menu-dropdown-panel,
  .app-header .app-header-user.align-right > .menu-dropdown-panel {
    left: 0;
    right: auto;
    width: min(280px, calc(100vw - 44px));
  }
}
