/* ==========================================================================
   DownPortal — Chrome, Navigation, Sidebar & Layout Shell
   ========================================================================== */

/* Header (Deep Slate Dark Chrome) */
.sa-header {
  background-color: var(--header-bg);
  position: relative;
  z-index: 1000;
  border-bottom: 1px solid var(--header-border);
}

.admin-bar .sa-header {
  top: 0;
}

.sa-header__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--ui-header-height, 64px);
  min-height: var(--ui-header-height, 64px);
  max-height: var(--ui-header-height, 64px);
  gap: clamp(12px, 2vw, 24px);
}

.sa-mobile-menu-btn {
  display: none;
  color: var(--ui-on-action);
  padding: 6px;
  border-radius: var(--radius-xs);
}

.sa-brand {
  display: inline-flex;
  align-items: center;
  color: var(--ui-on-action);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  height: 100%;
  max-height: 64px;
  overflow: hidden;
}

.sa-brand img,
.sa-brand__logo,
.custom-logo {
  display: block;
  max-height: 42px;
  height: 42px;
  width: auto;
  max-width: min(220px, 45vw);
  object-fit: contain;
}

/* Search Bar */
.sa-search-wrap {
  flex: 1 1 50%;
  max-width: 580px;
  min-width: 220px;
  position: relative;
}

.sa-search {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-pill, 9999px);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  padding: 0 4px 0 0;
  height: 42px;
  overflow: hidden;
  transition: all 0.15s ease;
  position: relative;
}

.sa-search:focus-within,
.sa-search.has-value {
  background: #ffffff;
  border-color: var(--ui-color-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.sa-search:focus-within .sa-search__input,
.sa-search.has-value .sa-search__input {
  color: #0f172a;
}

.sa-search:focus-within .sa-search__btn,
.sa-search.has-value .sa-search__btn {
  color: var(--ui-color-primary, #2563eb);
}

.sa-search__input {
  flex: 1;
  height: 42px;
  border: none;
  padding: 0 10px 0 16px;
  font-size: 13.5px;
  font-family: var(--font-sans, inherit);
  font-weight: 500;
  color: #ffffff;
  background: transparent;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.sa-search__input::-webkit-search-cancel-button,
.sa-search__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.sa-search__input::placeholder {
  color: #94a3b8;
}

.sa-search__clear {
  display: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  border: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-right: 4px;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.sa-search__clear:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.sa-search-kbd {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xs, 3px);
  padding: 1px 5px;
  margin-right: 4px;
  pointer-events: none;
  user-select: none;
  line-height: 1.2;
  flex-shrink: 0;
  transition: opacity 0.12s ease;
}

.sa-search:focus-within .sa-search-kbd,
.sa-search.has-value .sa-search-kbd {
  display: none;
}

.sa-search__btn {
  height: 42px;
  padding: 0 14px;
  color: #94a3b8;
  display: grid;
  place-items: center;
  transition: color 0.12s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.sa-search__btn:hover {
  color: #2563eb;
}

/* Instant Search Dropdown */
.sa-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 520px;
  max-width: 620px;
  background: #ffffff;
  border: 1px solid var(--ui-color-border-soft, #e2e8f0);
  border-radius: var(--ui-radius-md, 8px);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.18), 0 8px 16px -4px rgba(0, 0, 0, 0.08);
  z-index: 1200;
  overflow: hidden;
  display: none;
  animation: saSearchFadeIn 0.12s ease-out;
}

@keyframes saSearchFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sa-search-dropdown.is-open {
  display: flex;
  flex-direction: column;
}

.sa-search-dropdown-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sa-search-dropdown-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sa-search-dropdown-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}

.sa-search-clear-history-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  transition: color 0.12s ease;
}

.sa-search-clear-history-btn:hover {
  color: #dc2626;
  text-decoration: underline;
}

.sa-search-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sa-search-quick-tags--empty {
  justify-content: center;
  margin-top: 10px;
}

.sa-search-tag-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--ui-radius-pill, 9999px);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sa-search-tag-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.sa-search-recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sa-search-recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--ui-radius-xs, 3px);
  font-size: 13px;
  color: #1e293b;
  cursor: pointer;
  transition: background 0.1s ease;
}

.sa-search-recent-item:hover {
  background: #f1f5f9;
}

.sa-search-recent-item__icon {
  color: #94a3b8;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sa-search-recent-item__text {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sa-search-recent-item__remove {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.1s ease;
}

.sa-search-recent-item__remove:hover {
  color: #dc2626;
  background: #fee2e2;
}

.sa-search-dropdown-header {
  padding: 8px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.sa-search-dropdown-list {
  display: flex;
  flex-direction: column;
  max-height: 440px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.sa-search-dropdown-item {
  display: grid;
  grid-template-columns: 66px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  color: #0f172a;
  transition: background 0.1s ease;
}

.sa-search-dropdown-item:last-child {
  border-bottom: none;
}

.sa-search-dropdown-item:hover,
.sa-search-dropdown-item.is-keyboard-active {
  background: #f8fafc;
}

.sa-search-dropdown-thumb {
  width: 66px;
  height: 46px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  flex-shrink: 0;
}

.sa-search-dropdown-item__content {
  min-width: 0;
  overflow: hidden;
}

.sa-search-dropdown-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.sa-search-dropdown-title mark {
  background: #fef08a;
  color: #0f172a;
  padding: 0 3px;
  border-radius: 2px;
  font-weight: 700;
}

.sa-search-dropdown-meta {
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.sa-search-dropdown-cat {
  font-size: 10.5px;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  padding: 1px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sa-search-dropdown-bullet {
  color: #cbd5e1;
}

.sa-search-dropdown-size {
  font-weight: 700;
  color: #1e293b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
}

.sa-search-dropdown-author {
  color: #475569;
  font-weight: 600;
}

.sa-search-dropdown-date {
  color: #64748b;
  font-weight: 450;
}

.sa-search-dropdown-arrow {
  color: #94a3b8;
  font-size: 14px;
  opacity: 0;
  transition: all 0.12s ease;
  transform: translateX(-4px);
  display: flex;
  align-items: center;
}

.sa-search-dropdown-item:hover .sa-search-dropdown-arrow,
.sa-search-dropdown-item.is-keyboard-active .sa-search-dropdown-arrow {
  opacity: 1;
  transform: translateX(0);
  color: #2563eb;
}

.sa-search-dropdown-footer {
  padding: 10px 14px;
  background: var(--ui-surface-subtle, #f8fafc);
  border-top: 1px solid var(--ui-border, #e2e8f0);
  font-size: 12.5px;
  font-weight: 600;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sa-search-dropdown-footer:hover {
  background: #2563eb;
  color: #ffffff;
}

.sa-search-dropdown-footer:hover .footer-key-hint {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.sa-search-dropdown-footer .footer-key-hint {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #ffffff;
  padding: 1px 6px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-xs, 3px);
  font-family: var(--font-mono, monospace);
  transition: all 0.12s ease;
}

.sa-search-dropdown-empty {
  padding: 24px 16px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sa-search-dropdown-empty__icon {
  color: #94a3b8;
  margin-bottom: 4px;
}

.sa-search-dropdown-empty__text {
  font-size: 13.5px;
  color: #1e293b;
}

.sa-search-dropdown-empty__sub {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}

/* Active Search Filter Bar */
.sa-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 16px 0;
  border-bottom: 1.5px solid var(--ui-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}

.sa-filter-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sa-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ui-surface);
  border: 1.5px solid var(--border-dashed);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13.5px;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: all 0.12s ease;
}

.sa-filter-chip:hover {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
}

.sa-filter-chip__tag {
  font-size: 12px;
  font-weight: 800;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sa-filter-chip__tag--action {
  color: var(--ui-action);
}

.sa-filter-chip__val {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.sa-filter-chip__btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-xs);
  transition: all 0.1s ease;
}

.sa-filter-chip__btn:hover {
  background: var(--semantic-danger-bg);
  color: var(--semantic-danger);
}

.sa-filter-bar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: #64748b;
}

.sa-filter-bar__right strong {
  color: #0f172a;
  font-weight: 800;
}

.sa-filter-clear-all {
  color: #2563eb;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 13.5px;
}

.sa-filter-clear-all:hover {
  text-decoration: underline;
  color: #1d4ed8;
}

/* Header Actions */
.sa-header__actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 14px);
  position: relative;
  flex-shrink: 0;
}

.sa-header-action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #e2e8f0;
  height: 40px;
  padding: 0 12px;
  cursor: pointer;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 700;
  gap: 8px;
  transition: all 0.15s ease;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.sa-header-action-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.sa-header-action-btn.is-icon-only {
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
  flex-shrink: 0;
}

.sa-header-action-btn.is-icon-only svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.1;
  transition: transform 0.12s ease;
}

.sa-header-action-btn.is-icon-only:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  transform: translateY(-1px);
}

.sa-header-action-btn.is-icon-only:hover svg {
  transform: scale(1.08);
}

#header-messages-btn {
  color: var(--semantic-message, #38bdf8);
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.38);
}

#header-messages-btn svg {
  fill: var(--semantic-message, #38bdf8);
  color: var(--semantic-message, #38bdf8);
}

#header-messages-btn:hover {
  background: rgba(56, 189, 248, 0.24);
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
}

#header-messages-btn:hover svg {
  fill: #7dd3fc;
  color: #7dd3fc;
}

.sa-header-action-btn.is-user-pill {
  width: auto;
  padding: 4px 12px 4px 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  gap: 8px;
}

.sa-header-action-btn.is-user-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.sa-header-action-btn.is-active-fav {
  color: var(--semantic-favourite, #f43f5e);
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.38);
}

.sa-header-action-btn.is-active-fav svg {
  fill: var(--semantic-favourite, #f43f5e);
  color: var(--semantic-favourite, #f43f5e);
}

.sa-header-action-btn.is-active-fav:hover {
  background: rgba(244, 63, 94, 0.22);
  color: #fb7185;
}

.sa-header-action-btn.is-active-msg {
  color: var(--semantic-message, #38bdf8);
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
}

.sa-header-action-btn.is-active-msg svg {
  color: var(--semantic-message, #38bdf8);
  fill: var(--semantic-message, #38bdf8);
}

.sa-header-action-btn.is-active-msg:hover {
  background: rgba(56, 189, 248, 0.26);
  color: #7dd3fc;
}

.sa-header-action-btn.is-vip-pill {
  width: auto;
  background: var(--ui-color-primary);
  color: #ffffff;
  padding: 0 16px;
  height: 38px;
  border-radius: var(--radius-pill);
  gap: 6px;
  font-weight: 750;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sa-header-action-btn.is-vip-pill:hover {
  background: var(--ui-color-primary-hover);
}

.sa-header-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  background: var(--semantic-favourite, #f43f5e);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  border: 2px solid #080d1a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}

.sa-header-badge.is-messages {
  background: #0284c7;
  color: #ffffff;
  min-width: 18px;
}

.sa-header-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--ui-color-primary);
  color: #ffffff;
  font-size: var(--type-caption-size, 12px);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sa-header-avatar.is-vip {
  background: var(--color-vip);
}

.sa-header-avatar.is-image {
  object-fit: cover;
}

.sa-header-avatar img.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-pill);
}

.sa-header-action-wrap,
.sa-user-menu-wrap {
  position: relative;
}

/* User Dropdown Menu */
.sa-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 245px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 2000;
  overflow: hidden;
  padding: 6px;
  animation: dropdownPop 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownPop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sa-user-dropdown[hidden] {
  display: none !important;
}

.sa-user-dropdown.is-open {
  display: flex !important;
}

.sa-user-dropdown-header {
  padding: 8px 12px 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: transparent;
}

.sa-user-dropdown-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sa-user-dropdown-role {
  font-size: 11px;
  color: #2563eb;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sa-user-dropdown-role.is-vip {
  color: #d97706;
}

.sa-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  font-size: 13.5px;
  font-weight: 650;
  color: #1e293b;
  border-radius: 6px;
  transition: all 0.12s ease;
  text-decoration: none;
}

.sa-user-dropdown-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
  color: #475569;
  transition: color 0.12s ease;
}

.sa-user-dropdown-item:hover {
  background: #f8fafc;
  color: #0f172a;
}

.sa-user-dropdown-item:hover svg {
  color: #0f172a;
}

.sa-user-dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 0;
}

.sa-user-dropdown-item.is-logout {
  color: #dc2626;
  font-weight: 700;
}

.sa-user-dropdown-item.is-logout svg {
  color: #dc2626;
}

.sa-user-dropdown-item.is-logout:hover {
  background: #fef2f2;
  color: #b91c1c;
}

/* User pill rotation on open */
.sa-header-action-btn.is-user-pill svg.lucide-chevron-down {
  transition: transform 0.2s ease;
}

.sa-header-action-btn.is-user-pill[aria-expanded="true"] svg.lucide-chevron-down {
  transform: rotate(180deg);
}

/* Category Subnav & Mega Menu */
.sa-subnav {
  background-color: #090e1a;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 2px solid #111c30;
  position: relative;
  z-index: 1000;
}

.sa-subnav__inner {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: var(--ui-subnav-height);
}

.sa-subnav__menu {
  display: flex;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.sa-subnav__item {
  position: relative;
  display: flex;
  align-items: stretch;
}

.sa-subnav__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 11px;
  color: #ffffff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11.5px;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.12s ease;
}

.sa-subnav__link:hover {
  color: #38bdf8;
  background: rgba(255, 255, 255, 0.08);
}

.sa-subnav__link.is-active {
  color: #38bdf8;
  background: rgba(2, 132, 199, 0.12);
  border-bottom-color: #38bdf8;
  font-weight: 750;
}

.sa-subnav__chevron-svg {
  width: 9px;
  height: 9px;
  stroke-width: 2;
  opacity: 0.65;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.sa-subnav__item:hover .sa-subnav__chevron-svg {
  transform: rotate(180deg);
  opacity: 1;
}

.sa-subnav__right {
  display: flex;
  align-items: stretch;
}

.sa-subnav__divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  align-self: center;
  margin: 0 6px;
}

/* Mega Menu Dropdowns */
.sa-megamenu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 18px 22px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.12s ease,
    visibility 0.12s ease;
  z-index: 9999;
  pointer-events: none;
}

.sa-megamenu--5col {
  width: 1080px;
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.sa-megamenu--4col {
  width: 880px;
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.sa-megamenu--3col {
  width: 680px;
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.sa-megamenu--2col {
  width: 440px;
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.sa-megamenu--align-right {
  left: auto;
  right: 0;
}

.sa-megamenu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.sa-subnav__item:hover > .sa-megamenu,
.sa-megamenu:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sa-megamenu__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sa-megamenu__title {
  font-size: 12px;
  font-weight: 750;
  text-transform: none;
  letter-spacing: 0.01em;
  color: #0f172a;
  border-bottom: 1.5px solid #e2e8f0;
  padding-bottom: 6px;
  margin-bottom: 8px;
  display: block;
}

.sa-megamenu__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sa-megamenu__link {
  color: #334155;
  font-size: 13px;
  font-weight: 450;
  padding: 5px 7px;
  border-radius: var(--radius-xs);
  text-decoration: none;
  transition: all 0.1s ease;
}

.sa-megamenu__link:hover {
  background: #f1f5f9;
  color: #1d4ed8;
  font-weight: 600;
  transform: translateX(2px);
}

/* 2-Column Application Layout Grid */
.app-layout {
  display: grid;
  grid-template-columns: minmax(
      0,
      var(--ui-feed-width)
    ) var(--ui-sidebar-width);
  gap: clamp(24px, 3vw, 40px);
  column-gap: clamp(28px, 3.5vw, 44px);
  padding: clamp(16px, 2.5vw, 28px) 0 48px;
  align-items: start;
  width: 100%;
  max-width: var(--ui-content-width, 1160px);
  margin-inline: auto;
  justify-content: center;
}

.app-layout--full {
  grid-template-columns: 1fr;
  width: 100%;
  max-width: var(--ui-content-width, 1160px);
  margin-inline: auto;
}

.main-column {
  min-width: 0;
  width: 100%;
}

.app-layout--full .main-column {
  max-width: 100%;
}

/* Right Sidebar & Widgets */
.right-sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar-section {
  background: transparent;
  padding: 0;
  border: none;
}

.sidebar-section + .sidebar-section {
  margin-top: 28px;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #000000;
  border-bottom: 2px solid #000000;
  padding-bottom: 6px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sa-drawer-menu {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sa-drawer-menu li {
  margin: 0;
}

.sa-drawer-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.sa-drawer-menu li a:hover,
.sa-drawer-menu li.current-menu-item > a {
  background: var(--bg-subtle);
  color: var(--ui-color-primary);
}

.sa-drawer-member {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.sa-drawer-member__title {
  padding: 0 10px 6px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.sidebar-link-item:hover,
.sidebar-link-item.is-active {
  background: var(--bg-subtle);
  color: var(--ui-color-primary);
}

/* Popular Tags Cloud (Rounded Soft Gray Pills) */
.sidebar-tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: #f1f5f9;
  border: none;
  color: #334155;
  font-size: 12.5px;
  font-weight: 650;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
  line-height: 1.4;
}

.tag-cloud-item:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}

.vip-premium-widget {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vip-premium-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 3px 0;
}

.vip-premium-intro {
  font-size: 12.5px;
  line-height: 1.45;
  color: #475569;
  margin: 0 0 2px 0;
}

.aff-link-item {
  color: #2563eb;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  line-height: 1.35;
  transition: color 0.12s ease;
}

.aff-link-item:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.vip-user-link {
  display: inline-block;
  margin-top: 5px;
  color: var(--text-dark, #090d16);
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  line-height: 1.35;
  transition: color 0.12s ease;
}

.vip-user-link:hover {
  color: var(--ui-color-primary);
  text-decoration: underline;
}

.master-pwd-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 6px;
}

.master-pwd-box code {
  font-family: var(--font-code);
  font-weight: 800;
  color: #2563eb;
  background: #dbeafe;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
}

.top-downloads-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.top-download-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 0;
  border-radius: var(--radius-xs);
  transition: background 0.12s ease;
  text-decoration: none;
}

.top-download-item:hover {
  background: var(--bg-subtle);
}

.top-download-rank {
  font-size: 15px;
  font-weight: 900;
  color: #64748b; /* AA on white (4.76:1); keep muted. */
  line-height: 1.25;
  min-width: 28px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  transition: color 0.12s ease;
}

.top-download-item:hover .top-download-rank {
  color: var(--ui-color-primary);
}

.top-download-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.top-download-title {
  font-weight: 750;
  font-size: 13.5px;
  color: #0f172a;
  line-height: 1.38;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.12s ease;
}

.top-download-item:hover .top-download-title {
  color: var(--ui-color-primary);
}

.top-download-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}

.top-download-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #475569;
}

.top-download-stat svg {
  width: 14px;
  height: 14px;
  color: #64748b;
}

.top-download-author {
  color: #2563eb;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  transition: color 0.12s ease;
}

.top-download-author:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 24px 0 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-main);
  user-select: none;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn,
.pagination .page-numbers {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--canvas);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s ease;
}

.page-btn.page-arrow,
.pagination .prev.page-numbers,
.pagination .next.page-numbers {
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0 8px;
}

.page-btn.page-arrow svg,
.pagination .prev.page-numbers svg,
.pagination .next.page-numbers svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
  display: block;
}

.page-btn:hover:not(:disabled):not(.is-active),
.pagination .page-numbers:hover:not(.current):not(.dots) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--ui-color-primary);
}

.page-btn.is-active,
.pagination .page-numbers.current {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  font-weight: 800;
}

.page-btn:disabled {
  color: var(--text-quaternary);
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
  cursor: not-allowed;
  opacity: 0.45;
}

.page-ellipsis,
.pagination .page-numbers.dots {
  min-width: 16px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-weight: 700;
  font-size: 0.75rem;
  background: transparent;
  border: none;
  cursor: default;
}

/* Mobile Drawer Overlay & Sidebar */
.sa-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 1500;
  display: none;
}

.sa-drawer-overlay.is-open {
  display: block;
}

.sa-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--ui-surface);
  z-index: 1510;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}

.sa-drawer.is-open {
  transform: translateX(0);
}

.sa-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-main);
  margin-bottom: 16px;
}

/* Footer (Dark Chrome) */
.sa-footer {
  margin-top: auto;
  background: var(--header-bg);
  border-top: 1px solid var(--header-border);
  color: #94a3b8;
  font-size: 13px;
  padding: 28px 0 24px;
}

.sa-footer__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.sa-footer__brand-col {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.sa-footer__brand {
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sa-footer__tagline {
  color: #cbd5e1;
}

.sa-footer__legal {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--header-border);
}

.sa-footer__disclaimer {
  margin: 0;
  max-width: 760px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #cbd5e1;
}

.sa-footer__disclaimer p {
  margin: 0 0 6px;
}

.sa-footer__disclaimer p:last-child {
  margin-bottom: 0;
}

.sa-footer__links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.sa-footer__links a,
.sa-footer-menu a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.12s ease;
}

.sa-footer__links a:hover,
.sa-footer-menu a:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.sa-footer-menu {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sa-footer-menu li {
  margin: 0;
}

.sa-back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: var(--ui-color-primary);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.sa-back-to-top:hover {
  background: var(--ui-color-primary-hover);
  color: #ffffff;
}

.sa-back-to-top:focus-visible {
  outline: 2px solid var(--ui-color-primary);
  outline-offset: 2px;
}

.sa-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sa-drawer-header__title {
  color: var(--ui-color-text-strong);
  font-size: var(--type-title-md-size);
}

.sa-drawer-header__close {
  color: var(--ui-color-text-muted);
  font-size: var(--type-title-md-size);
}
