.ap-launcher-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 100%;
}
.ap-launcher-wrap .ap-launcher-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  white-space: nowrap;
}
.ap-launcher-wrap .ap-launcher-label i {
  color: #a5b4fc;
}
.ap-launcher-field {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 420px;
}
.ap-launcher-input {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(45, 49, 66, 0.9);
  background: rgba(15, 17, 23, 0.85);
  color: #e2e8f0;
}
.ap-launcher-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.ap-launcher-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1200;
  max-height: min(320px, 50vh);
  overflow: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  border-radius: 10px;
  border: 1px solid rgba(45, 49, 66, 0.95);
  background: #161a24;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  display: none;
}
.ap-launcher-dropdown.is-open {
  display: block;
}
.ap-launcher-dropdown li button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e2e8f0;
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.ap-launcher-dropdown li button:hover,
.ap-launcher-dropdown li button:focus {
  background: rgba(99, 102, 241, 0.18);
  outline: none;
}
.ap-launcher-dropdown .ap-opt-code {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: #c7d2fe;
  margin-right: 0.45rem;
}
.ap-launcher-dropdown .ap-opt-short {
  color: #94a3b8;
}
.ap-launcher-dropdown .ap-opt-parent {
  display: block;
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 0.1rem;
}
.ap-launcher-go {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #6366f1;
  background: #6366f1;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.ap-launcher-go:hover {
  background: #4f46e5;
  border-color: #4f46e5;
}
.ap-launcher-go:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.home-tree-toolbar .ap-launcher-wrap {
  margin-left: auto;
  flex: 1 1 auto;
  justify-content: flex-end;
}

/* Home 2 — AP launcher in top navbar after logo */
.scmx-home-navbar-inner {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}
.scmx-home-navbar {
  position: sticky;
  top: 0;
  z-index: 1040;
}
.scmx-home-navbar:has(.ap-launcher-wrap.is-engaged) {
  z-index: 10050;
}
.scmx-home-navbar .navbar-ap-launcher {
  flex: 1 1 240px;
  min-width: 0;
  max-width: min(520px, 58vw);
  margin: 0 0.25rem 0 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(45, 49, 66, 0.85);
  background: rgba(22, 26, 36, 0.65);
}
.ap-launcher-wrap.is-engaged {
  position: relative;
  z-index: 10051;
}
.scmx-home-navbar .navbar-ap-launcher.is-engaged {
  z-index: 10051;
}
.ap-launcher-wrap.is-engaged .ap-launcher-dropdown {
  z-index: 10052;
}
.scmx-home-navbar .navbar-ap-launcher .ap-launcher-field {
  max-width: none;
}
@media (max-width: 991px) {
  .scmx-home-navbar .navbar-ap-launcher {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    margin: 0.35rem 0 0;
  }
}

/* Browse-all button (opens modal) */
.ap-launcher-browse {
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
  cursor: pointer;
  line-height: 1;
}
.ap-launcher-browse:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: #6366f1;
  color: #e0e7ff;
}

/* AP Code Browser modal */
body.ap-browser-open {
  overflow: hidden;
}
.ap-browser-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ap-browser-modal.is-open {
  display: flex;
}
.ap-browser-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}
.ap-browser-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 96vw);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid rgba(45, 49, 66, 0.95);
  background: #12151c;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  color: #e2e8f0;
  overflow: hidden;
}
.ap-browser-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid rgba(45, 49, 66, 0.85);
}
.ap-browser-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
}
.ap-browser-head h2 i {
  color: #a5b4fc;
}
.ap-browser-sub {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: #64748b;
}
.ap-browser-close {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.1rem;
  padding: 0.25rem 0.45rem;
  border-radius: 8px;
  cursor: pointer;
}
.ap-browser-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}
.ap-browser-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid rgba(45, 49, 66, 0.65);
}
.ap-browser-search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
}
.ap-browser-search-wrap i {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.78rem;
  pointer-events: none;
}
.ap-browser-search {
  width: 100%;
  font-size: 0.82rem;
  padding: 0.45rem 0.65rem 0.45rem 2rem;
  border-radius: 9px;
  border: 1px solid rgba(45, 49, 66, 0.95);
  background: rgba(15, 17, 23, 0.9);
  color: #e2e8f0;
}
.ap-browser-search:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.ap-browser-parent-filter {
  font-size: 0.78rem;
  padding: 0.42rem 0.55rem;
  border-radius: 9px;
  border: 1px solid rgba(45, 49, 66, 0.95);
  background: rgba(15, 17, 23, 0.9);
  color: #e2e8f0;
  max-width: 220px;
}
.ap-browser-count {
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
  margin-left: auto;
}
.ap-browser-body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.9fr);
  min-height: 0;
  flex: 1 1 auto;
}
.ap-browser-list-wrap {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid rgba(45, 49, 66, 0.65);
}
.ap-browser-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.ap-browser-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #161a24;
}
.ap-browser-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  border-bottom: 1px solid rgba(45, 49, 66, 0.85);
}
.ap-browser-table td {
  padding: 0.42rem 0.75rem;
  border-bottom: 1px solid rgba(45, 49, 66, 0.45);
  vertical-align: top;
}
.ap-browser-table tbody tr {
  cursor: pointer;
}
.ap-browser-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.08);
}
.ap-browser-table tbody tr.is-selected {
  background: rgba(99, 102, 241, 0.18);
}
.ap-browser-code {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: #c7d2fe;
  font-size: 0.8rem;
}
.ap-browser-parent-cell {
  color: #94a3b8;
  max-width: 160px;
}
.ap-browser-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.82rem;
}
.ap-browser-detail {
  padding: 0.85rem 1rem;
  overflow: auto;
  background: rgba(15, 17, 23, 0.55);
}
.ap-browser-detail-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}
.ap-browser-detail-code {
  font-family: ui-monospace, monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: #c7d2fe;
  margin-bottom: 0.65rem;
}
.ap-browser-detail-dl {
  margin: 0 0 0.85rem;
}
.ap-browser-detail-dl > div {
  margin-bottom: 0.55rem;
}
.ap-browser-detail-dl dt {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0 0 0.12rem;
}
.ap-browser-detail-dl dd {
  margin: 0;
  font-size: 0.8rem;
  color: #e2e8f0;
  word-break: break-word;
}
.ap-browser-url {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: #94a3b8 !important;
}
.ap-browser-open-btn {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.45rem 0.75rem;
  border-radius: 9px;
  border: 1px solid #6366f1;
  background: #6366f1;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.ap-browser-open-btn:hover {
  background: #4f46e5;
  border-color: #4f46e5;
}
.ap-browser-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1.15rem;
  border-top: 1px solid rgba(45, 49, 66, 0.85);
  background: rgba(15, 17, 23, 0.45);
}
.ap-browser-hint {
  font-size: 0.68rem;
  color: #64748b;
}
.ap-browser-hint kbd {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  margin: 0 0.1rem;
  border-radius: 4px;
  border: 1px solid rgba(45, 49, 66, 0.95);
  background: rgba(22, 26, 36, 0.9);
  font-family: inherit;
  font-size: 0.65rem;
  color: #94a3b8;
}
.ap-browser-foot-close {
  font-size: 0.78rem;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(45, 49, 66, 0.95);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}
.ap-browser-foot-close:hover {
  color: #e2e8f0;
  border-color: #64748b;
}
.d-none {
  display: none !important;
}
@media (max-width: 768px) {
  .ap-browser-body {
    grid-template-columns: 1fr;
  }
  .ap-browser-list-wrap {
    max-height: 42vh;
    border-right: none;
    border-bottom: 1px solid rgba(45, 49, 66, 0.65);
  }
  .ap-browser-count {
    margin-left: 0;
    width: 100%;
  }
}
