/* Loaded by the novatest reverse proxy, outside the replaceable Sub2API binary.
   Hide user redemption and channel status; administrator pages remain available. */
a[href="/redeem"],
a[href="/redeem/"],
a[href="https://mynva.store/redeem"],
a[href="https://mynva.store/redeem/"],
a[href="/monitor"],
a[href="/monitor/"],
a[href="https://mynva.store/monitor"],
a[href="https://mynva.store/monitor/"] {
  display: none !important;
}

/* Profile page: hide the 2FA (TOTP) and Passkey cards. Both features are disabled in the
   admin settings; the cards are the last two .card children of the profile shell.
   Selectors follow Sub2API v0.2.10 markup; re-check them after upgrading Sub2API. */
[data-testid="profile-shell"] > .card:nth-last-child(-n+2):not([data-testid]) {
  display: none !important;
}

/* Profile page: hide the LinuxDo / DingTalk / OIDC / WeChat binding rows (those logins are
   disabled) and keep the email row. A row is the element containing that provider's status
   badge but not the email one, which excludes the shared list container. */
[data-testid="profile-auth-bindings-panel"] div:has([data-testid="profile-binding-linuxdo-status"]):not(:has([data-testid="profile-binding-email-status"])),
[data-testid="profile-auth-bindings-panel"] div:has([data-testid="profile-binding-dingtalk-status"]):not(:has([data-testid="profile-binding-email-status"])),
[data-testid="profile-auth-bindings-panel"] div:has([data-testid="profile-binding-oidc-status"]):not(:has([data-testid="profile-binding-email-status"])),
[data-testid="profile-auth-bindings-panel"] div:has([data-testid="profile-binding-wechat-status"]):not(:has([data-testid="profile-binding-email-status"])) {
  display: none !important;
}

/* Sidebar: show the custom entries "一键配置" (/custom/telo-setup), "模型指纹探测" (/custom/model-probe) and
   "性能-价格" (/custom/perf-price) directly below "API 密钥" (/keys); their menu sort_order (0, 1, 2) keeps
   that sequence. The section becomes a flex column: the title, the links up to and including /keys, then
   these custom entries, then everything else in its original order. */
.sidebar-section:has(> a[href="/custom/model-probe"]) {
  display: flex;
  flex-direction: column;
}
.sidebar-section:has(> a[href="/custom/model-probe"]) > * {
  order: 3;
}
.sidebar-section:has(> a[href="/custom/model-probe"]) > .sidebar-section-title {
  order: 0;
}
.sidebar-section:has(> a[href="/custom/model-probe"]) > :has(~ a[href="/keys"]),
.sidebar-section:has(> a[href="/custom/model-probe"]) > a[href="/keys"] {
  order: 1;
}
.sidebar-section:has(> a[href="/custom/model-probe"]) > a[href="/custom/telo-setup"],
.sidebar-section:has(> a[href="/custom/model-probe"]) > a[href="/custom/model-probe"],
.sidebar-section:has(> a[href="/custom/model-probe"]) > a[href="/custom/perf-price"] {
  order: 2;
}

/* Header: WeChat support button (host-ui.js) and its QR dialog. The card is dark frosted glass in both
   themes: it blurs the page through a tinted scrim instead of sitting on an opaque panel. The scrim has
   no backdrop-filter or opacity of its own, so the card's backdrop is the page rather than the scrim. */
.nc-cs-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: rgba(2, 6, 23, 0);
  transition: background-color .22s ease;
}
.nc-cs-overlay[hidden] {
  display: none;
}
.nc-cs-overlay.nc-cs-open {
  background-color: rgba(2, 6, 23, .5);
}
.nc-cs-card {
  position: relative;
  width: min(332px, 100%);
  padding: 22px 22px 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 28px;
  color: #f8fafc;
  background:
    radial-gradient(130% 70% at 0% 0%, rgba(45, 212, 191, .2), transparent 55%),
    radial-gradient(120% 80% at 100% 100%, rgba(56, 189, 248, .14), transparent 60%),
    linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .03) 55%),
    rgba(12, 20, 36, .42);
  box-shadow:
    0 32px 80px -24px rgba(0, 0, 0, .7),
    inset 0 1px 0 rgba(255, 255, 255, .26);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  opacity: 0;
  transform: translateY(10px) scale(.97);
  transition: opacity .22s ease, transform .32s cubic-bezier(.2, .9, .25, 1);
}
.nc-cs-open .nc-cs-card {
  opacity: 1;
  transform: none;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nc-cs-card {
    background-color: rgba(12, 20, 36, .94);
  }
}
.nc-cs-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  color: rgba(248, 250, 252, .72);
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.nc-cs-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, .16);
}
.nc-cs-close:focus-visible {
  outline: 2px solid rgba(94, 234, 212, .8);
  outline-offset: 2px;
}
.nc-cs-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 36px;
}
.nc-cs-avatar {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 8px 20px -8px rgba(45, 212, 191, .55);
}
.nc-cs-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .01em;
}
.nc-cs-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12.5px;
  color: rgba(226, 232, 240, .68);
}
.nc-cs-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #07c160;
  box-shadow: 0 0 0 3px rgba(7, 193, 96, .18);
}
.nc-cs-qr {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 22px;
  background: rgba(2, 6, 23, .34);
  box-shadow: inset 0 1px 12px rgba(0, 0, 0, .25);
}
.nc-cs-qr img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  user-select: none;
  -webkit-user-drag: none;
}
.nc-cs-hint {
  margin: 14px 0 0;
  font-size: 13px;
  text-align: center;
  letter-spacing: .02em;
  color: rgba(226, 232, 240, .72);
}
@media (prefers-reduced-motion: reduce) {
  .nc-cs-overlay,
  .nc-cs-card {
    transition: none;
  }
}

/* /keys page only (class set by host-ui.js): put the action buttons
   (refresh / 列设置 / 创建密钥) on the SAME row as the search & filter controls,
   right-aligned, instead of a separate row floating above them.
   Scoped to /keys and desktop width so other TablePageLayout screens are untouched. */
@media (min-width: 1024px) {
  html.nc-keys-page .table-page-layout { position: relative; }
  /* #actions section (first fixed section) -> pin to the top-right */
  html.nc-keys-page .table-page-layout > .layout-section-fixed:first-child {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    z-index: 5;
  }
  /* #filters section (now the first in-flow section) -> keep its controls clear of the buttons */
  html.nc-keys-page .table-page-layout > .layout-section-fixed:nth-child(2) {
    padding-right: 360px;
  }
}
