.topbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 14px 18px !important;
  background: rgba(255,255,255,0.96) !important;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line) !important;
  box-shadow: 0 8px 24px rgba(16,24,40,.06);
}

.topbar::after {
  content: "";
  display: table;
  clear: both;
}

.shell {
  padding-top: 110px !important;
}

body.theme-dark .topbar {
  background: rgba(15,23,42,0.96) !important;
  border-bottom: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

@media (max-width: 900px) {
  .topbar {
    padding: 12px 14px !important;
  }

  .shell {
    padding-top: 140px !important;
  }
}

/* compact profile chip cleanup */
.profile-chip-main {
  min-width: 230px;
  padding: 10px 38px 10px 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-chip-info {
  gap: 2px;
}

.profile-chip-name {
  margin: 0;
}

.profile-chip-meta {
  margin: 0;
}

.profile-menu-toggle {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #cbd5e1;
}

.profile-chip-menu-head {
  padding-bottom: 0;
  margin-bottom: 10px;
  border-bottom: 0;
}

/* compact profile chip */
.profile-chip-main {
  min-width: 238px;
  padding: 10px 34px 10px 12px;
  gap: 10px;
}

.profile-chip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-chip-name {
  font-size: 13px;
  line-height: 1.2;
}

.profile-chip-meta {
  font-size: 12px;
  line-height: 1.2;
}

.profile-menu-toggle {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
}

/* =========================================================
   migrated from compat.css - first split pass
   ========================================================= */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

body.theme-dark .user-chip {
  background: #111827;
  border-color: rgba(255,255,255,0.08);
}

body.theme-dark .user-chip-name {
  color: #e5e7eb;
}

body.theme-dark .user-chip-meta {
  color: #cbd5e1;
}

body.theme-dark .login-btn {
  background: #fff;
  color: #111827;
}

.powered-by-link {
  color: inherit;
  text-decoration: none;
}

.powered-by-link {
  color: inherit;
  text-decoration: none;
}

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #22c55e);
  color: #fff;
  flex: 0 0 auto;
}

.profile-avatar-large {
  width: 42px;
  height: 42px;
}

.profile-chip-menu-name {
  font-weight: 700;
  color: #fff;
  font-size: 13px;
}

.profile-chip-menu-meta {
  font-size: 12px;
  color: #cbd5e1;
}

.profile-chip-link:hover {
  background: rgba(255,255,255,0.06);
}

.profile-chip-link-danger {
  color: #fca5a5;
}

.profile-chip-guest .profile-chip-main {
  min-width: 160px;
}

body.theme-dark .profile-chip-main {
  background: rgba(15,23,42,0.95);
}

.ingest-inline-status {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-size: 12px;
  font-weight: 600;
}

.audit-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.audit-status-text {
  font-size: 12px;
  color: var(--muted, #64748b);
}

.audit-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.audit-status-pill.is-cached {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.audit-status-pill.is-fresh {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.refresh-audit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line, #dbe2ea);
  background: #fff;
  color: inherit;
}

.refresh-audit-btn:hover {
  background: #f8fafc;
}

body.theme-dark .audit-status-pill.is-cached {
  background: rgba(29, 78, 216, 0.18);
  color: #bfdbfe;
  border-color: rgba(191, 219, 254, 0.25);
}

body.theme-dark .audit-status-pill.is-fresh {
  background: rgba(4, 120, 87, 0.18);
  color: #a7f3d0;
  border-color: rgba(167, 243, 208, 0.25);
}

body.theme-dark .refresh-audit-btn {
  background: #111827;
  color: #e5e7eb;
  border-color: rgba(255,255,255,0.08);
}

.refresh-audit-btn.is-loading {
  opacity: 0.7;
  cursor: wait;
}

.theme-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line, #dbe2ea);
  background: #fff;
  cursor: pointer;
  margin-left: 10px;
}

.theme-icon {
  font-size: 14px;
  line-height: 1;
}

.company-switcher {
  min-width: 180px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line, #dbe2ea);
  background: #fff;
  font-size: 12px;
}

.audit-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.theme-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line, #dbe2ea);
  background: #fff;
  cursor: pointer;
  margin-left: 10px;
}

.theme-icon {
  font-size: 14px;
  line-height: 1;
}

.company-switcher {
  min-width: 180px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line, #dbe2ea);
  background: #fff;
  font-size: 12px;
}

.refresh-audit-btn.is-loading {
  opacity: 0.7;
  cursor: wait;
}

/* ===== Profile dropdown fix ===== */
.profile-chip {
  position: relative;
}

.profile-chip-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 9999;
}

.profile-chip.is-open .profile-chip-menu {
  display: block;
}

.topbar {
  overflow: visible !important;
}

/* ===== Header tightening ===== */
.topbar {
  padding-top: 10px;
  padding-bottom: 10px;
}

.topbar h1 {
  margin: 2px 0 0 0;
  font-size: 20px;
}

.eyebrow {
  margin-bottom: 2px;
  font-size: 11px;
  opacity: 0.7;
}

/* remove global top spacing if present */
body {
  margin-top: 0;
}

/* Profile dropdown animation */
.profile-chip {
  position: relative;
}

.profile-chip-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;

  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;

  transition: opacity 0.18s ease, transform 0.18s ease;
  will-change: opacity, transform;
}

/* Open state */
.profile-chip.is-open .profile-chip-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Optional subtle depth */
.profile-chip-menu {
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  border-radius: 10px;
}

/* ===== Attached profile dropdown ===== */
.profile-chip {
  position: relative;
  overflow: visible;
}

.profile-chip-menu {
  top: calc(100% - 6px);
  right: 0;
  min-width: 100%;
  background: linear-gradient(180deg, #0b122b 0%, #111b3b 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: 0;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 14px 28px rgba(0,0,0,0.28);
  padding: 10px 0 8px;
  z-index: 9999;
}

.profile-chip.is-open .profile-chip-main {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.profile-chip-link {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
}

.profile-chip-link:first-child {
  padding-top: 12px;
}

.profile-chip-link:last-child {
  padding-bottom: 12px;
}

.profile-chip-link:hover {
  background: rgba(255,255,255,0.05);
}

/* ===== Unified Profile Component ===== */

/* Shared surface */
.profile-chip-main,
.profile-chip-menu {
  background: linear-gradient(180deg, #0b122b 0%, #111b3b 100%);
  border: 1px solid rgba(255,255,255,0.08);
}

/* Remove double borders when open */
.profile-chip.is-open .profile-chip-main {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Dropdown merges perfectly */
.profile-chip-menu {
  top: calc(100% - 6px);
  border-top: 0;
  border-radius: 0 0 16px 16px;
}

/* Remove visual seam completely */
.profile-chip.is-open .profile-chip-menu {
  margin-top: -1px;
}

/* Cleaner hover */
.profile-chip-link:hover {
  background: rgba(255,255,255,0.06);
}

/* ===== Profile chip without dropdown ===== */
.profile-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logout-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  color: #f3f4f6;
  background: linear-gradient(180deg, #0b122b 0%, #111b3b 100%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 20px rgba(0,0,0,0.18);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.logout-icon-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #111b3b 0%, #17244d 100%);
  border-color: rgba(255,255,255,0.14);
}

.logout-icon-btn:active {
  transform: translateY(0);
}

/* Retire dropdown-specific UI */
.profile-menu-toggle,
.profile-chip-menu {
  display: none !important;
}

/* === mobile header system === */
.topbar-mobile-row {
  display: none;
}

.topbar-desktop-grid {
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(320px, 1fr) minmax(220px, auto) auto;
  gap: 14px;
  align-items: center;
}

.topbar-brand {
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line, #dbe2ea);
  background: #fff;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 0;
}

.mobile-menu-btn-line {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #111827;
  transition: transform .18s ease, opacity .18s ease;
}

.mobile-topbar-panel {
  display: none !important;
}

.mobile-topbar-panel.is-open {
  display: grid !important;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(15,23,42,.08);
}

.mobile-url-form {
  display: grid;
  gap: 10px;
}

.mobile-url-form input,
.mobile-url-form .analyze-website-btn,
.mobile-audit-status-bar .refresh-audit-btn,
.mobile-audit-status-bar .company-switcher,
.mobile-topbar-actions .login-btn,
.mobile-topbar-actions .signup-btn,
.mobile-topbar-actions .mobile-logout-btn {
  width: 100%;
}

.mobile-topbar-actions {
  display: grid;
  gap: 10px;
}

.profile-controls-mobile .profile-chip-main,
.mobile-guest-chip .profile-chip-main {
  min-width: 0;
  width: 100%;
}

@media (max-width: 900px) {
  .topbar {
    padding: 12px 14px !important;
  }

  .topbar-desktop-grid {
    display: none;
  }

  .topbar-mobile-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .topbar-brand h1 {
    font-size: 18px;
    line-height: 1.1;
  }

  .topbar-brand .eyebrow {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .topbar-actions,
  .audit-status-bar,
  .url-form {
    width: 100%;
  }

  .shell {
    padding-top: 88px !important;
  }

  .topbar.is-mobile-open .mobile-menu-btn-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .topbar.is-mobile-open .mobile-menu-btn-line:nth-child(2) {
    opacity: 0;
  }

  .topbar.is-mobile-open .mobile-menu-btn-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
}

body.theme-dark .mobile-menu-btn {
  background: #111827;
  color: #e5e7eb;
  border-color: rgba(255,255,255,0.08);
}

body.theme-dark .mobile-menu-btn-line {
  background: #e5e7eb;
}

body.theme-dark .mobile-topbar-panel.is-open {
  border-top-color: rgba(255,255,255,0.08);
}

/* === mobile panel animation === */
.mobile-topbar-panel {
  transform: translateY(-8px);
  opacity: 0;
  transition: all .18s ease;
}

.mobile-topbar-panel.is-open {
  transform: translateY(0);
  opacity: 1;
}

.solo-lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(124, 58, 237, 0.18);
  background: rgba(124, 58, 237, 0.08);
}

.solo-lock-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.solo-lock-title {
  font-size: 13px;
  font-weight: 700;
  color: #4c1d95;
}

.solo-lock-meta {
  font-size: 12px;
  color: #5b6475;
  word-break: break-word;
}

.solo-lock-upgrade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  background: #7c3aed;
  color: #fff;
  border: 1px solid #7c3aed;
}

.solo-lock-upgrade-btn:hover {
  opacity: .95;
}

.solo-lock-banner-mobile {
  display: grid;
  gap: 12px;
}

body.theme-dark .solo-lock-banner {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(167, 139, 250, 0.22);
}

body.theme-dark .solo-lock-title {
  color: #ddd6fe;
}

body.theme-dark .solo-lock-meta {
  color: #cbd5e1;
}

@media (max-width: 900px) {
  .solo-lock-banner {
    align-items: flex-start;
  }

  .solo-lock-upgrade-btn {
    width: 100%;
  }
}
