/* Yongaile console brand layer.
   Loaded after the upstream hashed CSS so these rules can remain small overrides. */
:root {
  --yongaile-navy: #0b1f44;
  --yongaile-navy-950: #061327;
  --yongaile-navy-900: #081a38;
  --yongaile-navy-800: #102a52;
  --yongaile-blue: #2f6fde;
  --yongaile-teal: #14b8a6;
  --yongaile-teal-bright: #2dd4bf;
  --yongaile-cyan: #67e8f9;
}

:root:not(.dark) {
  --primary: #2364d2;
  --primary-foreground: #ffffff;
  --ring: #0f9f93;
  --accent: #e8f7f5;
  --accent-foreground: #0b4f49;
  --sidebar: #f3f7fb;
  --sidebar-foreground: #173154;
  --sidebar-primary: #2364d2;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #ddf4f1;
  --sidebar-accent-foreground: #0b4f49;
  --sidebar-border: rgba(11, 31, 68, 0.12);
  --sidebar-ring: #14b8a6;
}

.dark {
  --background: #07162e;
  --foreground: #eef6ff;
  --card: #0c2145;
  --card-foreground: #eef6ff;
  --popover: #0d254c;
  --popover-foreground: #eef6ff;
  --primary: #3f83f8;
  --primary-foreground: #ffffff;
  --secondary: #10294f;
  --secondary-foreground: #cde7ef;
  --muted: #0d2448;
  --muted-foreground: #9fb3c8;
  --accent: #123b56;
  --accent-foreground: #a7f3eb;
  --border: rgba(148, 184, 220, 0.18);
  --input: rgba(148, 184, 220, 0.28);
  --ring: #2dd4bf;
  --sidebar: #071a38;
  --sidebar-foreground: #d9e8f7;
  --sidebar-primary: #3f83f8;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #123b56;
  --sidebar-accent-foreground: #a7f3eb;
  --sidebar-border: rgba(148, 184, 220, 0.18);
  --sidebar-ring: #2dd4bf;
  --chart-1: #67e8f9;
  --chart-2: #2dd4bf;
  --chart-3: #818cf8;
  --chart-4: #38bdf8;
  --chart-5: #34d399;
}

body {
  background-color: var(--background);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root:not(.dark) body {
  background:
    radial-gradient(circle at 12% -10%, rgba(20, 184, 166, 0.14), transparent 30rem),
    radial-gradient(circle at 88% 0%, rgba(47, 111, 222, 0.12), transparent 34rem),
    #f6f9fc !important;
}

.dark body {
  background:
    radial-gradient(circle at 12% -12%, rgba(20, 184, 166, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 0%, rgba(47, 111, 222, 0.18), transparent 34rem),
    linear-gradient(180deg, #081b3a 0%, #061327 48%, #050f20 100%) !important;
}

/* Top navigation: make the transparent upstream bar feel like a product console header. */
header.sticky {
  border-bottom: 1px solid color-mix(in oklab, var(--border) 78%, transparent);
  background: color-mix(in oklab, var(--background) 84%, transparent) !important;
  box-shadow: 0 10px 32px rgba(2, 8, 23, 0.12);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

header.sticky nav a,
header.sticky a[aria-label] {
  border-radius: 0.65rem;
}

header.sticky nav a:hover,
header.sticky a[aria-label]:hover {
  color: var(--yongaile-teal-bright);
}

/* Sidebar: wider, calmer, and branded while preserving the upstream layout system. */
[data-slot="sidebar-wrapper"] {
  --sidebar-width: 14rem !important;
}

[data-slot="sidebar-container"] {
  border-color: var(--sidebar-border) !important;
}

[data-slot="sidebar-inner"] {
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--sidebar) 94%, #ffffff 6%), var(--sidebar)) !important;
  box-shadow: inset -1px 0 0 color-mix(in oklab, var(--sidebar-border) 76%, transparent);
}

.dark [data-slot="sidebar-inner"] {
  background:
    radial-gradient(circle at 20% 0%, rgba(20, 184, 166, 0.09), transparent 14rem),
    linear-gradient(180deg, #081f42 0%, #071a38 100%) !important;
}

[data-slot="sidebar-header"] {
  border-bottom: 1px solid color-mix(in oklab, var(--sidebar-border) 72%, transparent);
  margin-bottom: 0.35rem;
  padding-bottom: 0.85rem;
}

[data-slot="sidebar-group-label"] {
  color: color-mix(in oklab, var(--sidebar-foreground) 58%, transparent) !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

[data-slot="sidebar-menu-button"],
[data-slot="sidebar-menu-sub-button"] {
  border-radius: 0.72rem;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

[data-slot="sidebar-menu-button"]:hover,
[data-slot="sidebar-menu-sub-button"]:hover {
  background: color-mix(in oklab, var(--sidebar-primary) 10%, transparent) !important;
  color: var(--sidebar-foreground) !important;
}

html body [data-slot="sidebar-menu-button"][data-active],
html body [data-slot="sidebar-menu-button"][data-active="true"],
html body [data-slot="sidebar-menu-button"][aria-current],
html body [data-slot="sidebar-menu-button"][aria-current="page"],
html body [data-slot="sidebar-menu-button"].active,
html body [data-slot="sidebar-menu-sub-button"][data-active],
html body [data-slot="sidebar-menu-sub-button"][data-active="true"],
html body [data-slot="sidebar-menu-sub-button"][aria-current],
html body [data-slot="sidebar-menu-sub-button"][aria-current="page"],
html body [data-slot="sidebar-menu-sub-button"].active {
  background-color: var(--sidebar-accent) !important;
  background-image: none !important;
  background: var(--sidebar-accent) !important;
  background-image: none !important;
  border-left: 0 !important;
  border-inline-start: 0 !important;
  box-shadow: none !important;
  color: var(--sidebar-accent-foreground) !important;
  font-weight: 650;
}

html body [data-slot="sidebar-menu-button"][data-active]::before,
html body [data-slot="sidebar-menu-button"][data-active="true"]::before,
html body [data-slot="sidebar-menu-button"][aria-current]::before,
html body [data-slot="sidebar-menu-button"][aria-current="page"]::before,
html body [data-slot="sidebar-menu-button"].active::before,
html body [data-slot="sidebar-menu-sub-button"][data-active]::before,
html body [data-slot="sidebar-menu-sub-button"][data-active="true"]::before,
html body [data-slot="sidebar-menu-sub-button"][aria-current]::before,
html body [data-slot="sidebar-menu-sub-button"][aria-current="page"]::before,
html body [data-slot="sidebar-menu-sub-button"].active::before,
html body [data-slot="sidebar-menu-button"][data-active]::after,
html body [data-slot="sidebar-menu-button"][data-active="true"]::after,
html body [data-slot="sidebar-menu-button"][aria-current]::after,
html body [data-slot="sidebar-menu-button"][aria-current="page"]::after,
html body [data-slot="sidebar-menu-button"].active::after,
html body [data-slot="sidebar-menu-sub-button"][data-active]::after,
html body [data-slot="sidebar-menu-sub-button"][data-active="true"]::after,
html body [data-slot="sidebar-menu-sub-button"][aria-current]::after,
html body [data-slot="sidebar-menu-sub-button"][aria-current="page"]::after,
html body [data-slot="sidebar-menu-sub-button"].active::after,
html body [data-slot="sidebar-menu-item"]:has(> [data-active])::before,
html body [data-slot="sidebar-menu-sub-item"]:has(> [data-active])::before,
html body [data-slot="sidebar-menu-item"]:has(> [data-active])::after,
html body [data-slot="sidebar-menu-sub-item"]:has(> [data-active])::after,
html body [data-slot="sidebar-menu-item"]:has(> [aria-current])::before,
html body [data-slot="sidebar-menu-sub-item"]:has(> [aria-current])::before,
html body [data-slot="sidebar-menu-item"]:has(> [aria-current])::after,
html body [data-slot="sidebar-menu-sub-item"]:has(> [aria-current])::after,
html body [data-slot="sidebar-menu-item"]:has(> .active)::before,
html body [data-slot="sidebar-menu-sub-item"]:has(> .active)::before,
html body [data-slot="sidebar-menu-item"]:has(> .active)::after,
html body [data-slot="sidebar-menu-sub-item"]:has(> .active)::after {
  content: none !important;
  display: none !important;
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  border-left: 0 !important;
  border-inline-start: 0 !important;
  box-shadow: none !important;
}

html.dark body [data-slot="sidebar-menu-button"][data-active],
html.dark body [data-slot="sidebar-menu-button"][data-active="true"],
html.dark body [data-slot="sidebar-menu-button"][aria-current],
html.dark body [data-slot="sidebar-menu-button"][aria-current="page"],
html.dark body [data-slot="sidebar-menu-button"].active,
html.dark body [data-slot="sidebar-menu-sub-button"][data-active],
html.dark body [data-slot="sidebar-menu-sub-button"][data-active="true"],
html.dark body [data-slot="sidebar-menu-sub-button"][aria-current],
html.dark body [data-slot="sidebar-menu-sub-button"][aria-current="page"],
html.dark body [data-slot="sidebar-menu-sub-button"].active {
  background-color: var(--sidebar-accent) !important;
  background-image: none !important;
  background: var(--sidebar-accent) !important;
  background-image: none !important;
  box-shadow: none !important;
}

/* Content cards and tables. */
[data-slot="sidebar-inset"] {
  background: transparent !important;
}

[data-slot="card"],
[data-slot="table-container"],
[data-slot="data-table-card"] {
  border-color: color-mix(in oklab, var(--border) 88%, transparent) !important;
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--card) 94%, #ffffff 6%), var(--card)) !important;
  box-shadow:
    0 16px 42px rgba(2, 8, 23, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.dark [data-slot="card"],
.dark [data-slot="table-container"],
.dark [data-slot="data-table-card"] {
  background:
    linear-gradient(180deg, rgba(17, 45, 83, 0.88), rgba(10, 32, 65, 0.94)) !important;
  box-shadow:
    0 18px 48px rgba(1, 6, 18, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

[data-slot="card"] {
  border-radius: 1rem;
}

[data-slot="card-title"] {
  letter-spacing: -0.015em;
}

/* Inputs and primary actions. */
[data-slot="input"],
[data-slot="input-group"],
[data-slot="textarea"],
[data-slot="select-trigger"],
[data-slot="combobox-trigger"] {
  border-radius: 0.72rem;
  border-color: color-mix(in oklab, var(--input) 88%, transparent);
  background: color-mix(in oklab, var(--background) 72%, var(--card)) !important;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

[data-slot="input"]:focus,
[data-slot="input-group"]:focus-within,
[data-slot="textarea"]:focus,
[data-slot="select-trigger"]:focus,
[data-slot="combobox-trigger"]:focus {
  border-color: var(--yongaile-teal) !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16) !important;
}

[data-slot="button"] {
  border-radius: 0.72rem;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

form button[type="submit"],
form [data-slot="button"][type="submit"] {
  background: linear-gradient(135deg, var(--yongaile-blue), var(--yongaile-teal)) !important;
  border-color: transparent !important;
  box-shadow: 0 10px 24px rgba(20, 184, 166, 0.18), 0 6px 18px rgba(47, 111, 222, 0.2);
  color: #ffffff !important;
  font-weight: 650;
}

form button[type="submit"]:not(:disabled):hover,
form [data-slot="button"][type="submit"]:not(:disabled):hover {
  box-shadow: 0 12px 28px rgba(20, 184, 166, 0.24), 0 8px 22px rgba(47, 111, 222, 0.26);
  transform: translateY(-1px);
}

/* Auth layout: turn the upstream centered form into a polished login card. */
div[class*="sm:w-[480px]"] {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 184, 220, 0.2);
  border-radius: 1.35rem;
  padding: clamp(1.5rem, 4vw, 2.35rem) !important;
  background:
    radial-gradient(circle at 88% 0%, rgba(45, 212, 191, 0.13), transparent 13rem),
    linear-gradient(180deg, rgba(17, 45, 83, 0.9), rgba(8, 26, 56, 0.95)) !important;
  box-shadow:
    0 28px 80px rgba(1, 6, 18, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

div[class*="sm:w-[480px]"]::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yongaile-blue), var(--yongaile-teal-bright));
  pointer-events: none;
}

div[class*="sm:w-[480px]"] h2 {
  color: #f4f9ff;
  font-size: clamp(1.55rem, 3vw, 1.9rem) !important;
  letter-spacing: -0.035em;
}

div[class*="sm:w-[480px]"] label,
div[class*="sm:w-[480px]"] [data-slot="form-label"] {
  color: #c8d9ec;
  font-weight: 600;
}

div[class*="sm:w-[480px]"] input,
div[class*="sm:w-[480px]"] [data-slot="input"],
div[class*="sm:w-[480px]"] [data-slot="input-group"] {
  color: #f4f9ff;
}

div[class*="sm:w-[480px]"] [data-slot="input"],
div[class*="sm:w-[480px]"] [data-slot="input-group"] {
  border-color: rgba(148, 184, 220, 0.3) !important;
  background: rgba(4, 15, 34, 0.52) !important;
}

div[class*="sm:w-[480px]"] input::placeholder {
  color: rgba(159, 179, 200, 0.72);
}

div[class*="sm:w-[480px]"] .text-muted-foreground {
  color: #9fb3c8 !important;
}

div[class*="sm:w-[480px]"] a {
  color: #67e8f9;
}

/* Keep code examples legible on the navy surface. */
pre,
code,
[data-slot="empty"],
[data-slot="command"] {
  border-radius: 0.8rem;
}

pre,
code {
  background: color-mix(in oklab, var(--muted) 62%, transparent);
  color: var(--foreground);
}

.dark pre,
.dark code {
  background: rgba(4, 15, 34, 0.48);
}

/*
  Hide upstream update/GitHub affordances aggressively. CSS cannot select elements by
  their visible text; text-only remnants are removed by console-brand.js. These rules
  cover stable hrefs plus common label/title/class/data attributes on compact controls.
*/
:is(button, a, span)[aria-label*="v1.0.0" i],
:is(button, a, span)[title*="v1.0.0" i],
:is(button, a, span)[class*="v1.0.0" i],
:is(button, a, span)[id*="v1.0.0" i],
:is(button, a, span)[data-tooltip*="v1.0.0" i],
:is(button, a, span)[data-content*="v1.0.0" i],
:is(button, a, span)[data-testid*="v1.0.0" i],
:is(button, a, span)[data-test*="v1.0.0" i],
:is(button, a, span)[data-version*="v1.0.0" i],
:is(button, a, span)[aria-label*="rc.52" i],
:is(button, a, span)[title*="rc.52" i],
:is(button, a, span)[class*="rc.52" i],
:is(button, a, span)[id*="rc.52" i],
:is(button, a, span)[data-tooltip*="rc.52" i],
:is(button, a, span)[data-content*="rc.52" i],
:is(button, a, span)[data-testid*="rc.52" i],
:is(button, a, span)[data-test*="rc.52" i],
:is(button, a, span)[data-version*="rc.52" i],
:is(button, a, span)[aria-label*="检查更新"],
:is(button, a, span)[title*="检查更新"],
:is(button, a, span)[data-tooltip*="检查更新"],
:is(button, a, span)[data-content*="检查更新"],
:is(button, a, span)[aria-label*="update-checker" i],
:is(button, a, span)[title*="update-checker" i],
:is(button, a, span)[class*="update-checker" i],
:is(button, a, span)[id*="update-checker" i],
:is(button, a, span)[data-tooltip*="update-checker" i],
:is(button, a, span)[data-content*="update-checker" i],
:is(button, a, span)[data-testid*="update-checker" i],
:is(button, a, span)[data-test*="update-checker" i],
:is(button, a, span)[class*="version" i],
:is(button, a, span)[data-testid*="version" i],
button[aria-label*="System updates" i],
button[title*="System updates" i],
[role="button"][aria-label*="System updates" i],
[role="button"][title*="System updates" i],
button[aria-label*="检查更新"],
button[title*="检查更新"],
[role="button"][aria-label*="检查更新"],
[role="button"][title*="检查更新"],
button[class*="update" i],
a[class*="update" i],
[role="button"][class*="update" i],
a[href*="github.com/QuantumNous" i],
a[href*="github.com/quantumnous" i],
a[href*="new-api/releases" i],
a[href*="system-settings/operations/update-checker" i] {
  display: none !important;
}

:is(td, th, [role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"]) :is(button, a, span):is(
  [aria-label*="v1.0.0" i],
  [title*="v1.0.0" i],
  [class*="v1.0.0" i],
  [id*="v1.0.0" i],
  [data-tooltip*="v1.0.0" i],
  [data-content*="v1.0.0" i],
  [data-testid*="v1.0.0" i],
  [data-test*="v1.0.0" i],
  [data-version*="v1.0.0" i],
  [aria-label*="rc.52" i],
  [title*="rc.52" i],
  [class*="rc.52" i],
  [id*="rc.52" i],
  [data-tooltip*="rc.52" i],
  [data-content*="rc.52" i],
  [data-testid*="rc.52" i],
  [data-test*="rc.52" i],
  [data-version*="rc.52" i],
  [class*="version" i],
  [data-testid*="version" i],
  [data-version]
),
:is(td, th, [role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"]) :is(button, a, span)[data-yongaile-version-unavailable],
:is(button, a, span):is([role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"])[data-yongaile-version-unavailable],
main :is(button, a, span)[data-yongaile-version-unavailable],
[data-slot="card"] :is(button, a, span)[data-yongaile-version-unavailable],
[class*="card" i] :is(button, a, span)[data-yongaile-version-unavailable] {
  display: inline !important;
}

li:has(> a[href*="system-settings/operations/update-checker" i]),
li:has(> div > a[href*="system-settings/operations/update-checker" i]),
li:has(> button > a[href*="system-settings/operations/update-checker" i]),
[role="menuitem"]:has(> a[href*="system-settings/operations/update-checker" i]),
[role="menuitem"]:has(> div > a[href*="system-settings/operations/update-checker" i]),
[data-slot="sidebar-menu-item"]:has(> a[href*="system-settings/operations/update-checker" i]),
[data-slot="sidebar-menu-item"]:has(> div > a[href*="system-settings/operations/update-checker" i]),
[data-slot="sidebar-menu-sub-item"]:has(> a[href*="system-settings/operations/update-checker" i]),
[data-slot="sidebar-menu-sub-item"]:has(> div > a[href*="system-settings/operations/update-checker" i]) {
  display: none !important;
}

@media (max-width: 767px) {
  [data-slot="sidebar-wrapper"] {
    --sidebar-width: 17rem !important;
  }

  div[class*="sm:w-[480px]"] {
    border-radius: 1rem;
    margin-inline: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-slot="sidebar-menu-button"],
  [data-slot="sidebar-menu-sub-button"],
  [data-slot="button"],
  form button[type="submit"] {
    transition: none;
  }
}
