/* =====================================================================
   星云收付 · Aurora Nebula Design System
   纯手写 CSS，零外部依赖。动效只使用 transform / opacity，
   避免大面积 filter / box-shadow 动画，防止低端设备掉帧。
   ===================================================================== */

/* -------------------------------------------------------------- 设计令牌 */
:root {
    color-scheme: dark;

    --bg: #05070f;
    --bg-2: #070b16;
    --bg-elev: #0b1120;
    --panel: rgba(16, 24, 43, 0.66);
    --panel-solid: #0d1424;
    --panel-hover: rgba(26, 37, 63, 0.75);

    --line: rgba(148, 163, 184, 0.13);
    --line-strong: rgba(148, 163, 184, 0.24);

    --text: #e9eefb;
    --text-2: #a7b2c9;
    --text-3: #6c7a96;

    --brand: #22d3ee;
    --brand-2: #818cf8;
    --brand-3: #c084fc;
    --brand-soft: rgba(34, 211, 238, 0.14);
    --mint: #34d399;
    --amber: #fbbf24;
    --rose: #fb7185;
    --sky: #38bdf8;

    --grad-brand: linear-gradient(120deg, #22d3ee 0%, #818cf8 55%, #c084fc 100%);
    --grad-brand-soft: linear-gradient(120deg, rgba(34, 211, 238, 0.18), rgba(129, 140, 248, 0.14), rgba(192, 132, 252, 0.12));

    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius: 14px;
    --radius-sm: 10px;

    --shadow-lg: 0 30px 90px -28px rgba(0, 0, 0, 0.85);
    --shadow-md: 0 18px 45px -22px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 0 1px rgba(34, 211, 238, 0.18), 0 18px 50px -18px rgba(34, 211, 238, 0.35);

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

    --sidebar-w: 266px;
    --sidebar-w-collapsed: 84px;
    --topbar-h: 72px;

    --grid-line: rgba(148, 163, 184, 0.055);
    --noise-opacity: 0.035;

    --font-sans: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
    color-scheme: light;

    --bg: #f3f6fc;
    --bg-2: #eef2f9;
    --bg-elev: #ffffff;
    --panel: rgba(255, 255, 255, 0.78);
    --panel-solid: #ffffff;
    --panel-hover: rgba(255, 255, 255, 0.95);

    --line: rgba(15, 23, 42, 0.08);
    --line-strong: rgba(15, 23, 42, 0.16);

    --text: #0f1a2e;
    --text-2: #4b5b75;
    --text-3: #7c8aa5;

    --brand: #0891b2;
    --brand-2: #4f46e5;
    --brand-3: #7c3aed;
    --brand-soft: rgba(8, 145, 178, 0.1);
    --mint: #059669;
    --amber: #b45309;
    --rose: #e11d48;
    --sky: #0284c7;

    --grad-brand: linear-gradient(120deg, #06b6d4 0%, #6366f1 55%, #a855f7 100%);
    --grad-brand-soft: linear-gradient(120deg, rgba(6, 182, 212, 0.14), rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));

    --shadow-lg: 0 30px 80px -32px rgba(15, 23, 42, 0.28);
    --shadow-md: 0 16px 40px -24px rgba(15, 23, 42, 0.24);
    --shadow-glow: 0 0 0 1px rgba(8, 145, 178, 0.16), 0 18px 46px -20px rgba(8, 145, 178, 0.28);

    --grid-line: rgba(15, 23, 42, 0.045);
    --noise-opacity: 0.02;
}

/* ------------------------------------------------------------------ 基础 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

img,
svg {
    display: block;
    max-width: 100%;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

p {
    margin: 0;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

code, kbd, pre, .mono {
    font-family: var(--font-mono);
}

::selection {
    background: rgba(34, 211, 238, 0.28);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 99px;
    border: 3px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.38);
    background-clip: content-box;
}

/* -------------------------------------------------------------- 背景层 */
.bg-aurora,
.bg-grid,
.bg-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.bg-aurora {
    z-index: -3;
    overflow: hidden;
}

.bg-aurora .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    transform: translate3d(0, 0, 0);
    will-change: transform;
    animation: drift 34s var(--ease) infinite alternate;
}

.blob--1 {
    width: 52vw;
    height: 52vw;
    left: -12vw;
    top: -16vw;
    background: radial-gradient(circle at 30% 30%, rgba(34, 211, 238, 0.55), transparent 65%);
}

.blob--2 {
    width: 44vw;
    height: 44vw;
    right: -10vw;
    top: -6vw;
    background: radial-gradient(circle at 60% 40%, rgba(129, 140, 248, 0.5), transparent 65%);
    animation-duration: 42s;
    animation-delay: -8s;
}

.blob--3 {
    width: 40vw;
    height: 40vw;
    left: 28vw;
    bottom: -22vw;
    background: radial-gradient(circle at 50% 50%, rgba(192, 132, 252, 0.38), transparent 65%);
    animation-duration: 50s;
    animation-delay: -16s;
}

[data-theme="light"] .bg-aurora .blob {
    opacity: 0.4;
}

.bg-grid {
    z-index: -2;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 58px 58px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

.bg-noise {
    z-index: -1;
    opacity: var(--noise-opacity);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(4%, 3%, 0) scale(1.06); }
    100% { transform: translate3d(-3%, 5%, 0) scale(1.02); }
}

/* -------------------------------------------------------------- 应用骨架 */
.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    padding: 18px 14px 16px;
    background: linear-gradient(180deg, rgba(11, 17, 32, 0.92), rgba(7, 11, 22, 0.88));
    border-right: 1px solid var(--line);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    transition: width 0.32s var(--ease), transform 0.32s var(--ease);
}

[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 255, 0.86));
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 20px;
    min-height: 58px;
}

.brand-mark {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--grad-brand);
    display: grid;
    place-items: center;
    box-shadow: 0 10px 26px -10px rgba(34, 211, 238, 0.7);
}

.brand-mark svg {
    width: 22px;
    height: 22px;
    color: #04121a;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 15px;
    border: 1px solid rgba(34, 211, 238, 0.28);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.sidebar__brand:hover .brand-mark::after {
    opacity: 1;
    transform: scale(1);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    overflow: hidden;
    white-space: nowrap;
}

.brand-text strong {
    font-size: 16px;
    letter-spacing: 0.02em;
}

.brand-text small {
    font-size: 10.5px;
    color: var(--text-3);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin-top: 3px;
}

.nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
}

.nav-group {
    margin-bottom: 14px;
}

.nav-group-label {
    padding: 8px 12px 6px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    height: 40px;
    padding: 0 12px;
    margin-bottom: 2px;
    border-radius: 11px;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}

.nav-item:hover {
    color: var(--text);
    background: rgba(148, 163, 184, 0.08);
    transform: translateX(2px);
}

.nav-item.is-active {
    color: #fff;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.16), rgba(129, 140, 248, 0.07));
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.16);
}

[data-theme="light"] .nav-item.is-active {
    color: #083344;
}

.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 3px;
    background: var(--grad-brand);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.9);
}

.nav-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 20px;
    color: currentColor;
    opacity: 0.85;
}

.nav-item.is-active .nav-icon {
    color: var(--brand);
    opacity: 1;
}

.nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-badge {
    flex: 0 0 auto;
    min-width: 20px;
    height: 19px;
    padding: 0 6px;
    border-radius: 7px;
    background: rgba(251, 113, 133, 0.16);
    color: #fda4af;
    font-size: 10.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: grid;
    place-items: center;
}

[data-theme="light"] .nav-badge {
    background: rgba(225, 29, 72, 0.1);
    color: #be123c;
}

.sidebar-foot {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.sidebar-tip {
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--grad-brand-soft);
    border: 1px solid rgba(34, 211, 238, 0.14);
    margin-bottom: 10px;
    overflow: hidden;
}

.sidebar-tip strong {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 4px;
}

.sidebar-tip span {
    display: block;
    font-size: 11px;
    color: var(--text-2);
    line-height: 1.55;
}

.sidebar-foot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-3);
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.collapse-btn:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text);
}

.sidebar-version {
    font-size: 10.5px;
    color: var(--text-3);
    font-family: var(--font-mono);
}

/* 折叠态 */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .sidebar-tip,
body.sidebar-collapsed .sidebar-version {
    opacity: 0;
    visibility: hidden;
}

body.sidebar-collapsed .sidebar__brand {
    padding-left: 12px;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .main {
    margin-left: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .collapse-btn {
    transform: rotate(180deg);
}

/* 主区域 */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.32s var(--ease);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 clamp(18px, 2.6vw, 34px);
    border-bottom: 1px solid var(--line);
    background: rgba(7, 11, 22, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.6);
}

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

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-3);
}

.eyebrow::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 10px var(--brand);
}

.topbar-heading h1 {
    font-size: 17px;
    font-weight: 650;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.06);
    color: var(--text-2);
    transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s;
}

.icon-btn:hover {
    background: rgba(148, 163, 184, 0.13);
    color: var(--text);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

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

.icon-btn .dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 0 2px var(--bg);
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    min-width: 230px;
    padding: 0 10px 0 13px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.05);
    color: var(--text-3);
    font-size: 12.5px;
    transition: border-color 0.2s, background 0.2s, width 0.3s var(--ease);
}

.search-trigger:hover {
    border-color: var(--line-strong);
    background: rgba(148, 163, 184, 0.09);
    color: var(--text-2);
}

.search-trigger span {
    flex: 1;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
}

kbd {
    display: inline-flex;
    align-items: center;
    height: 21px;
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-3);
    font-size: 10.5px;
    font-family: var(--font-mono);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    padding: 0 10px 0 5px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.05);
    transition: background 0.2s, border-color 0.2s;
}

.user-chip:hover {
    background: rgba(148, 163, 184, 0.1);
    border-color: var(--line-strong);
}

.avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--grad-brand-soft);
    border: 1px solid rgba(34, 211, 238, 0.22);
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.avatar--lg {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 15px;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
    max-width: 128px;
}

.user-name {
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10.5px;
    color: var(--text-3);
}

.mobile-only {
    display: none;
}

/* 下拉菜单 */
.dropdown {
    position: relative;
}

.dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 80;
    min-width: 260px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: var(--panel-solid);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}

.dropdown.is-open .dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.dropdown-head strong {
    display: block;
    font-size: 13px;
}

.dropdown-head span {
    font-size: 11px;
    color: var(--text-3);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 9px;
    color: var(--text-2);
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

.dropdown-item:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text);
}

.dropdown-item--danger {
    color: var(--rose);
}

.dropdown-item--danger:hover {
    background: rgba(251, 113, 133, 0.1);
    color: var(--rose);
}

.dropdown-divider {
    height: 1px;
    background: var(--line);
    margin: 6px 4px;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.15s;
}

.notif-item:hover {
    background: rgba(148, 163, 184, 0.08);
}

.notif-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--brand-soft);
    color: var(--brand);
    flex: 0 0 auto;
}

.notif-body {
    min-width: 0;
}

.notif-title {
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-desc {
    font-size: 11.5px;
    color: var(--text-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 内容区 */
.content {
    flex: 1;
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: clamp(18px, 2.4vw, 30px) clamp(18px, 2.6vw, 34px) 48px;
}

.page-enter > * {
    animation: rise 0.5s var(--ease-out) both;
}

.page-enter > *:nth-child(1) { animation-delay: 0ms; }
.page-enter > *:nth-child(2) { animation-delay: 45ms; }
.page-enter > *:nth-child(3) { animation-delay: 90ms; }
.page-enter > *:nth-child(4) { animation-delay: 130ms; }
.page-enter > *:nth-child(5) { animation-delay: 170ms; }
.page-enter > *:nth-child(6) { animation-delay: 205ms; }
.page-enter > *:nth-child(7) { animation-delay: 235ms; }
.page-enter > *:nth-child(8) { animation-delay: 260ms; }

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head h2 {
    font-size: clamp(22px, 2.4vw, 28px);
    letter-spacing: -0.03em;
}

.page-head .page-sub {
    margin-top: 5px;
    font-size: 13px;
    color: var(--text-2);
    max-width: 720px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 26px 0 12px;
}

.section-title h3 {
    font-size: 15px;
    font-weight: 650;
}

.section-title span {
    font-size: 12px;
    color: var(--text-3);
}

/* -------------------------------------------------------------- 卡片 */
.card {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)),
        var(--panel);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .card {
    background: var(--panel);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 40px -28px rgba(15, 23, 42, 0.28);
}

.card--flush {
    padding: 0;
}

.card--pad {
    padding: 20px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
}

.card-head--plain {
    border-bottom: 0;
    padding-bottom: 0;
}

.card-title {
    font-size: 14.5px;
    font-weight: 650;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title svg {
    color: var(--brand);
}

.card-sub {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-3);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.card-body {
    padding: 18px 20px;
}

.card-body--flush {
    padding: 0;
}

.hover-lift {
    transition: transform 0.24s var(--ease), border-color 0.24s, box-shadow 0.24s;
}

.hover-lift:hover {
    transform: translateY(-3px);
    border-color: rgba(34, 211, 238, 0.22);
    box-shadow: var(--shadow-lg);
}

/* -------------------------------------------------------------- 统计卡 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.stat-card {
    position: relative;
    padding: 18px 18px 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background:
        radial-gradient(120% 120% at 100% 0%, var(--stat-glow, rgba(34, 211, 238, 0.12)), transparent 55%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)),
        var(--panel);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.24s var(--ease), border-color 0.24s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.22);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--stat-glow, rgba(34, 211, 238, 0.14));
    filter: blur(38px);
    opacity: 0.55;
    pointer-events: none;
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 7px;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--stat-glow, rgba(34, 211, 238, 0.14));
    color: var(--stat-color, var(--brand));
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-value {
    margin-top: 12px;
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 700;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.stat-value small {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
    letter-spacing: 0;
}

.stat-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--text-3);
}

.stat-foot > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-foot .trend {
    flex: 0 0 auto;
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.trend--up {
    color: var(--mint);
    background: rgba(52, 211, 153, 0.12);
}

.trend--down {
    color: var(--rose);
    background: rgba(251, 113, 133, 0.12);
}

.trend--flat {
    color: var(--text-3);
    background: rgba(148, 163, 184, 0.12);
}

.stat-spark {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 30px;
    opacity: 0.38;
    pointer-events: none;
    mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

.stat-spark svg {
    width: 100%;
    height: 30px;
}

.stat--cyan { --stat-color: #22d3ee; --stat-glow: rgba(34, 211, 238, 0.14); }
.stat--violet { --stat-color: #a78bfa; --stat-glow: rgba(167, 139, 250, 0.14); }
.stat--mint { --stat-color: #34d399; --stat-glow: rgba(52, 211, 153, 0.13); }
.stat--amber { --stat-color: #fbbf24; --stat-glow: rgba(251, 191, 36, 0.12); }
.stat--rose { --stat-color: #fb7185; --stat-glow: rgba(251, 113, 133, 0.12); }
.stat--sky { --stat-color: #38bdf8; --stat-glow: rgba(56, 189, 248, 0.13); }

/* -------------------------------------------------------------- 按钮 */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: rgba(148, 163, 184, 0.07);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    transition: transform 0.18s var(--ease), background 0.18s, border-color 0.18s, box-shadow 0.18s, color 0.18s;
}

.btn:hover {
    transform: translateY(-1px);
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.32);
}

.btn:active {
    transform: translateY(0) scale(0.985);
}

.btn:disabled,
.btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn svg {
    flex: 0 0 auto;
}

.btn--primary {
    border: 0;
    color: #03121b;
    background: var(--grad-brand);
    box-shadow: 0 12px 30px -12px rgba(34, 211, 238, 0.65);
}

.btn--primary:hover {
    box-shadow: 0 18px 38px -14px rgba(34, 211, 238, 0.75);
    background: var(--grad-brand);
}

.btn--primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.6s var(--ease);
}

.btn--primary:hover::after {
    transform: translateX(120%);
}

.btn--ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--text-2);
}

.btn--ghost:hover {
    color: var(--text);
    background: rgba(148, 163, 184, 0.08);
}

.btn--danger {
    background: rgba(251, 113, 133, 0.12);
    border-color: rgba(251, 113, 133, 0.28);
    color: #fda4af;
}

[data-theme="light"] .btn--danger {
    color: #be123c;
}

.btn--danger:hover {
    background: rgba(251, 113, 133, 0.18);
}

.btn--sm {
    height: 32px;
    padding: 0 11px;
    font-size: 12px;
    border-radius: 9px;
}

.btn--xs {
    height: 27px;
    padding: 0 9px;
    font-size: 11.5px;
    border-radius: 8px;
    gap: 5px;
}

.btn--block {
    width: 100%;
}

.btn--icon {
    width: 38px;
    padding: 0;
}

.btn--loading {
    color: transparent !important;
    pointer-events: none;
}

.btn--loading::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

.btn--primary.btn--loading::before {
    border-color: rgba(3, 18, 27, 0.25);
    border-top-color: #03121b;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------- 徽标 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 23px;
    padding: 0 8px;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge--dot::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.badge--success {
    color: #6ee7b7;
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.2);
}

.badge--warning {
    color: #fcd34d;
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.2);
}

.badge--danger {
    color: #fda4af;
    background: rgba(251, 113, 133, 0.1);
    border-color: rgba(251, 113, 133, 0.2);
}

.badge--info {
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.2);
}

.badge--brand {
    color: #67e8f9;
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.22);
}

.badge--muted {
    color: var(--text-3);
    background: rgba(148, 163, 184, 0.09);
    border-color: var(--line);
}

[data-theme="light"] .badge--success { color: #047857; }
[data-theme="light"] .badge--warning { color: #b45309; }
[data-theme="light"] .badge--danger { color: #be123c; }
[data-theme="light"] .badge--info { color: #0369a1; }
[data-theme="light"] .badge--brand { color: #0e7490; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.05);
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
}

.chip--brand {
    color: var(--brand);
    border-color: rgba(34, 211, 238, 0.25);
    background: rgba(34, 211, 238, 0.08);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* -------------------------------------------------------------- 表格 */
.table-wrap {
    overflow: auto;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 11px 16px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    background: var(--panel-solid);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.065);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s var(--ease);
}

.data-table tbody tr:hover {
    background: rgba(148, 163, 184, 0.045);
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.data-table .mono {
    font-size: 12px;
    letter-spacing: -0.01em;
}

.cell-main {
    font-weight: 600;
    color: var(--text);
}

.cell-sub {
    font-size: 11.5px;
    color: var(--text-3);
    margin-top: 2px;
}

.cell-link {
    color: var(--brand);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 12px;
    transition: opacity 0.15s;
}

.cell-link:hover {
    opacity: 0.75;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cell-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.table-empty {
    padding: 54px 20px;
    text-align: center;
    color: var(--text-3);
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.filter-bar .field {
    margin: 0;
    min-width: 130px;
    flex: 1 1 140px;
}

.filter-bar .field--wide {
    min-width: 180px;
    flex: 1.4 1 200px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

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

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid transparent;
    color: var(--text-2);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.page-btn:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text);
}

.page-btn.is-active {
    background: var(--brand-soft);
    border-color: rgba(34, 211, 238, 0.26);
    color: var(--brand);
    font-weight: 700;
}

.page-btn.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.page-ellipsis {
    color: var(--text-3);
    padding: 0 4px;
}

/* -------------------------------------------------------------- 表单 */
.field {
    margin-bottom: 15px;
}

.field > label,
.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-2);
}

.field-label .req {
    color: var(--rose);
    font-size: 12px;
}

.field-hint {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--text-3);
    line-height: 1.55;
}

.field-error {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--rose);
}

.input,
.select,
.textarea {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: rgba(7, 11, 22, 0.55);
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s;
}

[data-theme="light"] .input,
[data-theme="light"] .select,
[data-theme="light"] .textarea {
    background: rgba(255, 255, 255, 0.9);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.11);
    background: rgba(7, 11, 22, 0.8);
}

[data-theme="light"] .input:focus,
[data-theme="light"] .select:focus,
[data-theme="light"] .textarea:focus {
    background: #fff;
}

.textarea {
    height: auto;
    min-height: 96px;
    padding: 11px 13px;
    resize: vertical;
    line-height: 1.65;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7a96' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.input--mono {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.01em;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .input {
    border-radius: 11px 0 0 11px;
}

.input-group .btn {
    border-radius: 0 11px 11px 0;
    border-left: 0;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.field-row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-top: 6px;
    flex-wrap: wrap;
}

/* 开关 */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-2);
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 99px;
    background: rgba(148, 163, 184, 0.22);
    border: 1px solid var(--line-strong);
    transition: background 0.22s var(--ease), border-color 0.22s;
    flex: 0 0 auto;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: transform 0.22s var(--ease-spring), background 0.22s;
}

.switch input:checked + .switch-track {
    background: linear-gradient(120deg, rgba(34, 211, 238, 0.8), rgba(129, 140, 248, 0.8));
    border-color: transparent;
}

.switch input:checked + .switch-track::after {
    transform: translateX(18px);
    background: #fff;
}

.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* 复选 / 单选 */
.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
}

.check input {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    margin: 0;
    border-radius: 5px;
    border: 1px solid var(--line-strong);
    background: rgba(7, 11, 22, 0.5);
    display: grid;
    place-items: center;
    transition: background 0.15s, border-color 0.15s;
    flex: 0 0 auto;
}

.check input:checked {
    background: var(--grad-brand);
    border-color: transparent;
}

.check input:checked::after {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #04121a;
    border-bottom: 2px solid #04121a;
    transform: rotate(-45deg) translateY(-1px);
}

/* -------------------------------------------------------------- 提示条 */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.06);
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.6;
}

.alert svg {
    flex: 0 0 auto;
    margin-top: 1px;
}

.alert--info {
    border-color: rgba(56, 189, 248, 0.22);
    background: rgba(56, 189, 248, 0.07);
    color: #bae6fd;
}

.alert--success {
    border-color: rgba(52, 211, 153, 0.22);
    background: rgba(52, 211, 153, 0.07);
    color: #a7f3d0;
}

.alert--warning {
    border-color: rgba(251, 191, 36, 0.24);
    background: rgba(251, 191, 36, 0.07);
    color: #fde68a;
}

.alert--danger {
    border-color: rgba(251, 113, 133, 0.24);
    background: rgba(251, 113, 133, 0.07);
    color: #fecdd3;
}

[data-theme="light"] .alert--info { color: #075985; }
[data-theme="light"] .alert--success { color: #065f46; }
[data-theme="light"] .alert--warning { color: #92400e; }
[data-theme="light"] .alert--danger { color: #9f1239; }

.alert strong {
    color: inherit;
}

/* -------------------------------------------------------------- 弹层 */
.modal,
.drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s var(--ease), visibility 0.24s;
}

.modal.is-open,
.drawer.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop,
.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 6, 14, 0.66);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 20px;
    border: 1px solid var(--line-strong);
    background: var(--panel-solid);
    box-shadow: var(--shadow-lg);
    transform: translateY(12px) scale(0.985);
    transition: transform 0.28s var(--ease-out);
}

.modal.is-open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-card--lg {
    width: min(760px, 100%);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 0;
}

.modal-head h3 {
    font-size: 16px;
}

.modal-head p {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-3);
}

.modal-body {
    padding: 18px 22px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 0 22px 20px;
}

.drawer {
    place-items: stretch end;
    padding: 0;
}

.drawer-card {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    height: 100%;
    overflow: auto;
    border-left: 1px solid var(--line-strong);
    background: var(--panel-solid);
    box-shadow: var(--shadow-lg);
    transform: translateX(30px);
    transition: transform 0.3s var(--ease-out);
}

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

.modal-close {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 0;
    background: rgba(148, 163, 184, 0.09);
    color: var(--text-2);
    flex: 0 0 auto;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: rgba(148, 163, 184, 0.18);
    color: var(--text);
}

/* -------------------------------------------------------------- Toast */
.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: min(390px, calc(100vw - 40px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border-radius: 13px;
    border: 1px solid var(--line-strong);
    background: var(--panel-solid);
    box-shadow: var(--shadow-lg);
    font-size: 12.5px;
    color: var(--text);
    pointer-events: auto;
    animation: toast-in 0.35s var(--ease-out) both;
}

.toast.is-leaving {
    animation: toast-out 0.25s var(--ease) both;
}

.toast-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    flex: 0 0 auto;
}

.toast--success .toast-icon { background: rgba(52, 211, 153, 0.14); color: var(--mint); }
.toast--danger .toast-icon { background: rgba(251, 113, 133, 0.14); color: var(--rose); }
.toast--warning .toast-icon { background: rgba(251, 191, 36, 0.14); color: var(--amber); }
.toast--info .toast-icon { background: rgba(56, 189, 248, 0.14); color: var(--sky); }

.toast-body strong {
    display: block;
    font-size: 12.5px;
    margin-bottom: 1px;
}

.toast-body span {
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.5;
}

.toast-close {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--text-3);
    padding: 2px;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateX(20px); }
}

/* -------------------------------------------------------------- 空状态 */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 52px 20px;
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--grad-brand-soft);
    border: 1px solid rgba(34, 211, 238, 0.16);
    color: var(--brand);
    margin-bottom: 2px;
}

.empty strong {
    font-size: 14px;
}

.empty p {
    font-size: 12.5px;
    color: var(--text-3);
    max-width: 420px;
}

/* -------------------------------------------------------------- 代码块 */
.code-block {
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(4, 8, 17, 0.72);
    overflow: hidden;
}

.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    color: var(--text-3);
    font-family: var(--font-mono);
}

.code-block pre {
    margin: 0;
    padding: 14px 16px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.75;
    color: #cbd5e1;
}

[data-theme="light"] .code-block {
    background: #0b1120;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-2);
    font-size: 10.5px;
    transition: background 0.15s, color 0.15s;
}

.copy-btn:hover {
    background: rgba(148, 163, 184, 0.16);
    color: var(--text);
}

/* -------------------------------------------------------------- 其他 */
.kv {
    display: grid;
    gap: 0;
}

.kv-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 12.5px;
}

.kv-row:last-child {
    border-bottom: 0;
}

.kv-key {
    color: var(--text-3);
    flex: 0 0 auto;
}

.kv-val {
    text-align: right;
    color: var(--text);
    word-break: break-all;
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 18px 0;
}

.muted {
    color: var(--text-3);
}

.text-sm {
    font-size: 12px;
}

.text-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: -0.01em;
}

.text-brand {
    color: var(--brand);
}

.text-success { color: var(--mint); }
.text-danger { color: var(--rose); }
.text-warning { color: var(--amber); }

.nowrap {
    white-space: nowrap;
}

.text-right {
    text-align: right;
}

.chip strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.grid-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wrap {
    flex-wrap: wrap;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.progress {
    height: 6px;
    border-radius: 99px;
    background: rgba(148, 163, 184, 0.14);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 99px;
    background: var(--grad-brand);
    transition: width 0.8s var(--ease-out);
}

.progress--mint .progress-bar { background: linear-gradient(90deg, #34d399, #22d3ee); }
.progress--amber .progress-bar { background: linear-gradient(90deg, #fbbf24, #fb923c); }
.progress--rose .progress-bar { background: linear-gradient(90deg, #fb7185, #f472b6); }

/* 时间线 */
.timeline {
    position: relative;
    padding-left: 22px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: linear-gradient(var(--brand), transparent);
    opacity: 0.35;
}

.timeline-item {
    position: relative;
    padding-bottom: 18px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -21px;
    top: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--brand);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.timeline-item.is-muted::before {
    border-color: var(--text-3);
    box-shadow: none;
}

.timeline-time {
    font-size: 11px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.timeline-title {
    font-size: 12.5px;
    font-weight: 600;
    margin: 2px 0;
}

.timeline-desc {
    font-size: 11.5px;
    color: var(--text-3);
    line-height: 1.55;
}

/* 页签 */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.07);
    border: 1px solid var(--line);
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 13px;
    border-radius: 9px;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 550;
    white-space: nowrap;
    transition: background 0.18s, color 0.18s;
}

.tab:hover {
    color: var(--text-2);
}

.tab.is-active {
    background: var(--panel-solid);
    color: var(--text);
    box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.4);
}

/* 快捷搜索浮层 */
.palette {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: grid;
    place-items: start center;
    padding: 12vh 20px 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), visibility 0.2s;
}

.palette.is-open {
    opacity: 1;
    visibility: visible;
}

.palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 6, 14, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.palette-card {
    position: relative;
    width: min(620px, 100%);
    border-radius: 18px;
    border: 1px solid var(--line-strong);
    background: var(--panel-solid);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(-8px) scale(0.99);
    transition: transform 0.24s var(--ease-out);
}

.palette.is-open .palette-card {
    transform: none;
}

.palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--text-3);
}

.palette-input {
    flex: 1;
    height: 26px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    outline: none;
}

.palette-list {
    max-height: 380px;
    overflow: auto;
    padding: 8px;
}

.palette-group {
    padding: 8px 10px 4px;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-3);
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.palette-item:hover,
.palette-item.is-focused {
    background: rgba(34, 211, 238, 0.09);
    color: var(--text);
}

.palette-item kbd {
    margin-left: auto;
}

.palette-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--text-3);
}

/* 顶部加载条 */
.route-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 300;
    height: 2px;
    width: 0;
    background: var(--grad-brand);
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.8);
    opacity: 0;
    transition: width 0.4s var(--ease-out), opacity 0.2s;
}

.route-progress.is-loading {
    opacity: 1;
}

/* 移动端遮罩 */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(3, 6, 14, 0.6);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

/* 工具类 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fade-in 0.4s var(--ease-out) both;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 响应式 */
@media (max-width: 1180px) {
    .grid-sidebar {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w);
        box-shadow: var(--shadow-lg);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    body.nav-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .main,
    body.sidebar-collapsed .main {
        margin-left: 0;
    }

    .mobile-only {
        display: inline-grid;
    }

    .search-trigger {
        min-width: 0;
        width: 38px;
        padding: 0;
        justify-content: center;
    }

    .search-trigger span,
    .search-trigger kbd {
        display: none;
    }

    .user-meta {
        display: none;
    }

    .user-chip {
        padding: 0 5px;
    }

    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-w);
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .nav-group-label,
    body.sidebar-collapsed .nav-text,
    body.sidebar-collapsed .nav-badge,
    body.sidebar-collapsed .sidebar-tip,
    body.sidebar-collapsed .sidebar-version {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-collapsed .nav-item {
        justify-content: flex-start;
        padding: 0 12px;
    }
}

@media (max-width: 760px) {
    .grid-2,
    .grid-3,
    .field-row--2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .topbar {
        gap: 10px;
        padding: 0 16px;
    }

    .topbar-heading h1 {
        font-size: 15px;
    }

    .content {
        padding: 16px 14px 40px;
    }

    .page-head {
        align-items: flex-start;
    }

    .filter-bar {
        padding: 14px;
    }

    .filter-bar .field {
        min-width: 0;
        flex: 1 1 45%;
    }

    .table-wrap {
        border-radius: 0;
    }

    .data-table {
        min-width: 760px;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .modal {
        padding: 12px;
        align-items: end;
    }

    .modal-card {
        width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 14px 14px;
    }

    .toast-stack {
        left: 14px;
        right: 14px;
        bottom: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .bg-aurora .blob {
        animation: none;
    }
}

/* 打印 */
@media print {
    .sidebar,
    .topbar,
    .page-actions,
    .filter-bar,
    .pagination,
    .toast-stack,
    .bg-aurora,
    .bg-grid,
    .bg-noise {
        display: none !important;
    }

    .main {
        margin-left: 0;
    }

    body {
        background: #fff;
        color: #000;
    }

    .card {
        box-shadow: none;
        border-color: #ddd;
        background: #fff;
    }
}
