.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid var(--color-border);
  background: rgb(255 255 255 / 96%);
}

.header-inner {
  min-height: 64px;
  gap: var(--space-6);
}

.primary-nav {
  gap: var(--space-5);
}

.nav-link {
  position: relative;
  padding-block: 21px;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover,
.nav-link-active {
  color: var(--color-ink);
}

.nav-link-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--color-brand);
  content: "";
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-inline: var(--space-4);
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 600;
  transition:
    background-color var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.header-action-primary {
  background: var(--color-brand);
  color: #fff;
}

.header-action-primary:hover {
  background: var(--color-brand-hover);
  color: #fff;
  transform: translateY(-1px);
}

.banner-text .btn,
.hero .btn,
.page-hero .btn {
  box-shadow: none !important;
}

.search-form,
.hero-search-full,
.banner-search {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  box-shadow: none;
}

.ui-icon {
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: -0.18em;
}

.search-type-trigger .st-icon {
  position: relative;
  display: inline-grid;
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  place-items: center;
}

.search-type-trigger .st-icon::before {
  width: 14px;
  height: 14px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
  content: "";
}

.search-type-trigger .st-icon::after {
  position: absolute;
  width: 6px;
  height: 1.8px;
  margin: 10px 0 0 10px;
  background: currentColor;
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
}

.upload-dropdown,
.user-dropdown,
.notify-dropdown,
.lang-dropdown,
.search-type-menu {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  box-shadow: var(--shadow-float);
}

.site-footer {
  margin-top: var(--space-16);
  padding-top: var(--space-12);
  background: #1d1d1b;
  color: #bdbdb7;
}

.footer-heading {
  margin: 0 0 var(--space-4);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.footer-links {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-launcher {
  position: fixed;
  z-index: 1000;
  right: 28px;
  bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-ink);
  color: #fff;
  box-shadow: var(--shadow-float);
  cursor: pointer;
  font-size: 20px;
  transition:
    background-color var(--motion-fast) ease,
    transform var(--motion-fast) ease;
}

.chat-launcher:hover {
  background: #2a2a27;
  transform: translateY(-1px);
}

.chat-launcher .chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--color-success);
}

#chat-panel {
  position: fixed;
  z-index: 999;
  right: 28px;
  bottom: 88px;
  display: flex;
  visibility: hidden;
  overflow: hidden;
  flex-direction: column;
  width: 380px;
  height: 560px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity var(--motion-base) ease,
    transform var(--motion-base) ease,
    visibility 0s var(--motion-base);
}

#chat-panel.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity var(--motion-base) ease,
    transform var(--motion-base) ease,
    visibility 0s;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  padding: 14px var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink);
}

.chat-head-avatar {
  display: grid;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-control);
  background: var(--color-canvas);
  font-size: 18px;
  place-items: center;
}

.chat-head-info {
  flex: 1;
}

.chat-head-info strong {
  display: block;
  font-size: 14px;
}

.chat-head-info span {
  color: var(--color-text-muted);
  font-size: 11px;
}

.chat-head-close {
  display: grid;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  place-items: center;
}

.chat-head-close:hover {
  background: var(--color-canvas);
  color: var(--color-ink);
}

.chat-quick {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.chat-quick button {
  min-height: 32px;
  padding-inline: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 12px;
}

.chat-quick button:hover {
  border-color: var(--color-brand);
  color: var(--color-brand-hover);
}

#chat-messages {
  display: flex;
  overflow-y: auto;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: var(--space-4);
  background: var(--color-canvas);
  scroll-behavior: smooth;
}

.bot-msg,
.user-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
}

.bot-msg {
  align-self: flex-start;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.user-msg {
  align-self: flex-end;
  background: var(--color-brand);
  color: #fff;
}

.bot-msg.typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline: 2px;
  border-radius: 50%;
  background: var(--color-text-muted);
  opacity: 0.64;
}

.bot-msg.typing span:nth-child(2) {
  opacity: 0.44;
}

.bot-msg.typing span:nth-child(3) {
  opacity: 0.28;
}

#chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

#chat-input {
  flex: 1;
  max-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-control);
  outline: none;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: none;
}

#chat-input:focus {
  border-color: var(--color-brand);
}

#chat-send {
  display: grid;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--color-brand);
  color: #fff;
  cursor: pointer;
  place-items: center;
}

#chat-send:hover {
  background: var(--color-brand-hover);
}

#chat-send:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 1199px) {
  .site-header {
    width: 100%;
  }

  .primary-nav,
  .site-header .search-form,
  .user-area {
    display: none;
  }
}

@media (max-width: 767px) {
  .site-header {
    position: sticky;
  }

  .header-inner {
    min-height: 56px;
  }

  .mobile-primary-action {
    min-height: 44px;
  }

  .mobile-bottom-nav {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: none;
  }

  .mbn-item {
    min-height: 52px;
  }

  .user-side {
    display: flex !important;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    height: 44px;
    padding: 0 var(--space-2);
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    background: var(--color-surface);
    scrollbar-width: none;
    white-space: nowrap;
  }

  .user-side::-webkit-scrollbar {
    display: none;
  }

  .user-side a {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 44px;
    padding-inline: 14px;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 13px;
  }

  .user-side a.active {
    border-bottom-color: var(--color-brand);
    background: transparent;
    color: var(--color-brand-hover);
    font-weight: 600;
  }

  #chat-panel {
    right: var(--space-4);
    bottom: 124px;
    width: calc(100vw - 32px);
    height: min(560px, calc(100vh - 168px));
  }

  .chat-launcher {
    right: var(--space-4);
    bottom: 76px;
  }
}
