/* ============================================================
   小企业财务做账记账系统 - 主样式表
   暗色科技玻璃拟态风格 (Dark Tech Glassmorphism)
   ============================================================ */

/* ============================================================
   1. CSS 变量定义
   ============================================================ */
:root {
    /* 主背景色 */
    --bg-primary:        #0a0e27;
    --bg-secondary:      #0f1438;
    --bg-tertiary:       #141b41;
    --bg-elevated:      #1a2350;

    /* 玻璃卡片 */
    --bg-glass:         rgba(20, 27, 65, 0.7);
    --bg-glass-light:   rgba(30, 41, 95, 0.55);
    --bg-glass-hover:   rgba(35, 48, 110, 0.8);
    --glass-blur:       16px;

    /* 边框 */
    --border-glass:     rgba(255, 255, 255, 0.1);
    --border-light:     rgba(255, 255, 255, 0.08);
    --border-strong:    rgba(255, 255, 255, 0.18);

    /* 主色调 - 科技蓝紫渐变 */
    --accent-1:         #6366f1;   /* indigo */
    --accent-2:         #8b5cf6;   /* violet */
    --accent-3:         #06b6d4;   /* cyan */
    --accent-glow:      rgba(99, 102, 241, 0.5);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-accent:  linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
    --gradient-sidebar: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);

    /* 文本颜色 - 最浅不低于 #aaa */
    --text-primary:     #ffffff;
    --text-secondary:    #cccccc;
    --text-tertiary:     #aaaaaa;
    --text-heading:     #ffffff;
    --text-muted:       #b8b8d0;

    /* 状态色 */
    --success:          #10b981;
    --success-bg:       rgba(16, 185, 129, 0.15);
    --success-border:   rgba(16, 185, 129, 0.4);
    --error:            #ef4444;
    --error-bg:         rgba(239, 68, 68, 0.15);
    --error-border:     rgba(239, 68, 68, 0.4);
    --warning:          #f59e0b;
    --warning-bg:       rgba(245, 158, 11, 0.15);
    --warning-border:   rgba(245, 158, 11, 0.4);
    --info:             #3b82f6;
    --info-bg:          rgba(59, 130, 246, 0.15);
    --info-border:      rgba(59, 130, 246, 0.4);

    /* 尺寸 */
    --sidebar-width:    260px;
    --sidebar-collapsed:80px;
    --topbar-height:    70px;
    --footer-height:    50px;
    --content-padding:  28px;
    --radius-sm:        8px;
    --radius-md:        12px;
    --radius-lg:        16px;
    --radius-xl:        22px;

    /* 阴影 */
    --shadow-sm:        0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md:        0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg:        0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow:      0 0 24px rgba(99, 102, 241, 0.35);
    --shadow-glow-strong: 0 0 32px rgba(99, 102, 241, 0.6);

    /* 过渡 */
    --transition-fast:  0.15s ease;
    --transition-base:  0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:  0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* 字体 */
    --font-sans:        "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
    --font-mono:        "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

/* ============================================================
   2. 基础重置
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 背景装饰 - 浮动光斑 */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
    animation: floatGlow 18s ease-in-out infinite;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    right: -5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
    animation: floatGlow 22s ease-in-out infinite reverse;
}

@keyframes floatGlow {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(40px, -30px) scale(1.1); }
}

a {
    color: var(--accent-1);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-2);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.9rem; }
h6 { font-size: 0.8rem; }

p { color: var(--text-secondary); }

ul, ol { list-style: none; }

img { max-width: 100%; display: block; }

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* ============================================================
   3. 滚动条样式
   ============================================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 14, 39, 0.5);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.5) 0%, rgba(139, 92, 246, 0.5) 100%);
    border-radius: 6px;
    border: 2px solid rgba(10, 14, 39, 0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.8) 0%, rgba(139, 92, 246, 0.8) 100%);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.6) rgba(10, 14, 39, 0.5);
}

/* ============================================================
   4. 应用主布局
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ============================================================
   5. 侧边栏
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border-right: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-base);
    overflow: hidden;
}

/* 侧边栏渐变光晕边框 */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: var(--gradient-primary);
    opacity: 0.6;
    box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-sidebar);
    pointer-events: none;
    z-index: 0;
}

.sidebar-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
    position: relative;
}

.sidebar-logo::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: var(--gradient-primary);
    opacity: 0.4;
    filter: blur(8px);
    z-index: -1;
}

.sidebar-brand {
    flex: 1;
    min-width: 0;
}

.sidebar-brand .brand-name {
    color: var(--text-heading);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand .brand-sub {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    margin-top: 2px;
}

/* 导航菜单 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    position: relative;
    z-index: 1;
}

.nav-section-title {
    color: var(--text-tertiary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 14px 12px 8px;
    font-weight: 600;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    background: var(--bg-glass-light);
    color: var(--text-primary);
    transform: translateX(2px);
}

.nav-link.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: #fff;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
}

.nav-arrow {
    transition: transform var(--transition-base);
    color: var(--text-tertiary);
    font-size: 0.7rem;
}

.nav-link.expanded .nav-arrow {
    transform: rotate(90deg);
    color: var(--accent-2);
}

/* 子菜单: 默认展开(无 JS 兜底可访问); 启用 JS 后支持折叠/展开 */
.nav-submenu {
    max-height: none;
    overflow: visible;
    padding-left: 32px;
}

html.js .nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

html.js .nav-submenu.open {
    max-height: 800px;
}

.nav-submenu .nav-link {
    padding: 9px 14px;
    font-size: 0.82rem;
    color: var(--text-tertiary);
}

.nav-submenu .nav-link::before {
    content: '•';
    position: absolute;
    left: 14px;
    color: var(--text-tertiary);
    background: none;
    width: auto;
    height: auto;
    box-shadow: none;
    transform: none;
    top: 50%;
    translate: 0 -50%;
}

.nav-submenu .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass-light);
}

.nav-submenu .nav-link.active {
    background: rgba(99, 102, 241, 0.2);
    color: #fff;
}

.nav-submenu .nav-link.active::before {
    color: #fff;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    position: relative;
    z-index: 1;
    color: var(--text-tertiary);
    font-size: 0.72rem;
    text-align: center;
}

/* ============================================================
   6. 主内容区
   ============================================================ */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin var(--transition-base);
}

/* ============================================================
   7. 顶栏
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    padding: 0 var(--content-padding);
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-title {
    flex: 1;
    min-width: 0;
}

.topbar-title h1 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title .page-desc {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* 期间选择器 */
.period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    backdrop-filter: blur(8px);
}

.period-selector label {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 500;
}

.period-selector select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding: 2px 4px;
}

.period-selector select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* 用户下拉 */
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 6px 14px 6px 6px;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-primary);
}

.user-toggle:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-glow);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 0 12px var(--accent-glow);
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.user-info .user-name {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.user-info .user-role {
    color: var(--text-tertiary);
    font-size: 0.7rem;
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 100;
}

.user-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 6px;
}

.user-menu-header .name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.user-menu-header .role {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    margin-top: 2px;
}

.user-menu a,
.user-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.user-menu a:hover,
.user-menu button:hover {
    background: var(--bg-glass-light);
    color: var(--text-primary);
}

.user-menu .divider {
    height: 1px;
    background: var(--border-light);
    margin: 6px 0;
}

.user-menu .logout {
    color: var(--error);
}

.user-menu .logout:hover {
    background: var(--error-bg);
}

/* 移动端汉堡按钮 */
.sidebar-toggle {
    display: none;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-glass-hover);
    box-shadow: var(--shadow-glow);
}

.sidebar-toggle svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

/* 遮罩 */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   8. 内容区
   ============================================================ */
.content {
    flex: 1;
    padding: var(--content-padding);
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header-info h2 {
    font-size: 1.5rem;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.page-header-info p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   9. 玻璃卡片
   ============================================================ */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.glass-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.15);
}

.glass-card.flush {
    padding: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 1.05rem;
    color: var(--text-heading);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 .accent-bar {
    width: 4px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--accent-glow);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   10. 网格系统
   ============================================================ */
.grid {
    display: grid;
    gap: 20px;
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* KPI 卡片 */
.kpi-card {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0.7;
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg), 0 0 28px rgba(99, 102, 241, 0.2);
}

.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.danger::before  { background: var(--error); }
.kpi-card.info::before    { background: var(--info); }

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.kpi-label {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-1);
}

.kpi-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kpi-value {
    color: var(--text-heading);
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    font-family: var(--font-mono);
}

.kpi-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.kpi-trend {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
}

.kpi-trend.up   { color: var(--success); background: var(--success-bg); }
.kpi-trend.down { color: var(--error);   background: var(--error-bg); }
.kpi-trend.flat { color: var(--text-tertiary); background: var(--bg-glass-light); }

/* ============================================================
   11. 按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass-light);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn:hover {
    border-color: var(--border-strong);
    background: var(--bg-glass-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 2px solid var(--accent-1);
    outline-offset: 2px;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-primary {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5558e0 0%, #7c4ff0 100%);
    border-color: transparent;
    box-shadow: var(--shadow-glow-strong);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-glass-light);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    color: #fff;
    box-shadow: 0 0 22px rgba(16, 185, 129, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    color: #fff;
    box-shadow: 0 0 22px rgba(239, 68, 68, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    color: #fff;
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.5);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-glass-light);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--accent-1);
    padding: 4px 8px;
}

.btn-link:hover {
    color: var(--accent-2);
    text-decoration: underline;
    transform: none;
    box-shadow: none;
    background: transparent;
}

.btn-group {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   12. 表单
   ============================================================ */
.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.form-label {
    display: block;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-hint {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-top: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(10, 14, 39, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-base);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.form-control:hover {
    border-color: var(--border-strong);
}

.form-control:focus {
    border-color: var(--accent-1);
    background: rgba(10, 14, 39, 0.7);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18), 0 0 16px rgba(99, 102, 241, 0.2);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaaaaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
    cursor: pointer;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

input[type="date"].form-control,
input[type="datetime-local"].form-control {
    color-scheme: dark;
}

input[type="file"].form-control {
    padding: 8px;
    background: rgba(10, 14, 39, 0.3);
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-1);
    cursor: pointer;
    vertical-align: middle;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.form-check label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.form-error {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 4px;
}

.form-control.is-invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .input-group-text {
    padding: 10px 14px;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.input-group .input-group-text:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.input-group .input-group-text:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

.input-group .form-control:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* ============================================================
   13. 表格
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}

.table tbody tr:hover td {
    color: var(--text-primary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .table-num {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.table .table-center { text-align: center; }
.table .table-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.table-striped tbody tr:nth-of-type(even) {
    background: rgba(255, 255, 255, 0.02);
}

.table-condensed thead th,
.table-condensed tbody td {
    padding: 9px 12px;
    font-size: 0.82rem;
}

/* ============================================================
   14. 徽章/标签
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.badge-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: var(--success-border);
}

.badge-error,
.badge-danger {
    color: var(--error);
    background: var(--error-bg);
    border-color: var(--error-border);
}

.badge-warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.badge-info {
    color: var(--info);
    background: var(--info-bg);
    border-color: var(--info-border);
}

.badge-default {
    color: var(--text-secondary);
    background: var(--bg-glass-light);
    border-color: var(--border-glass);
}

.badge-primary {
    color: var(--accent-1);
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.badge-dot.success { background: var(--success); box-shadow: 0 0 6px var(--success); }
.badge-dot.error   { background: var(--error);   box-shadow: 0 0 6px var(--error); }
.badge-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.badge-dot.info    { background: var(--info);    box-shadow: 0 0 6px var(--info); }

/* ============================================================
   15. 闪存消息 / Toast
   ============================================================ */
.flash-container,
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: calc(100% - 40px);
    pointer-events: none;
}

.toast,
.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.toast::before,
.flash::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.success,
.flash.success {
    border-color: var(--success-border);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-glass) 60%);
}

.toast.success::before,
.flash.success::before { background: var(--success); box-shadow: 0 0 12px var(--success); }

.toast.error,
.flash.error {
    border-color: var(--error-border);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, var(--bg-glass) 60%);
}

.toast.error::before,
.flash.error::before { background: var(--error); box-shadow: 0 0 12px var(--error); }

.toast.warning,
.flash.warning {
    border-color: var(--warning-border);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, var(--bg-glass) 60%);
}

.toast.warning::before,
.flash.warning::before { background: var(--warning); box-shadow: 0 0 12px var(--warning); }

.toast.info,
.flash.info {
    border-color: var(--info-border);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, var(--bg-glass) 60%);
}

.toast.info::before,
.flash.info::before { background: var(--info); box-shadow: 0 0 12px var(--info); }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon   { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon    { color: var(--info); }

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.82rem;
    word-wrap: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.toast.fade-out,
.flash.fade-out {
    animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

/* 内联提示 */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--text-primary); }
.alert-error   { background: var(--error-bg);   border-color: var(--error-border);   color: var(--text-primary); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--text-primary); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--text-primary); }

/* ============================================================
   16. 模态框
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.2);
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
    overflow: hidden;
    position: relative;
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

.modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.modal.modal-sm { max-width: 420px; }
.modal.modal-lg { max-width: 760px; }
.modal.modal-xl { max-width: 960px; }

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h3 {
    color: var(--text-heading);
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-glass-light);
}

.modal-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    color: var(--text-secondary);
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ============================================================
   17. 加载动画
   ============================================================ */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent-1);
    border-right-color: var(--accent-2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 12px var(--accent-glow);
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 39, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
    border-radius: inherit;
}

.loading-overlay .loading-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-1);
    animation: dotPulse 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(2) { animation-delay: 0.16s; background: var(--accent-2); }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; background: var(--accent-3); }

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ============================================================
   18. 进度条
   ============================================================ */
.progress {
    width: 100%;
    height: 8px;
    background: rgba(10, 14, 39, 0.6);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width var(--transition-slow);
    box-shadow: 0 0 10px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 1.6s linear infinite;
}

.progress-bar.success { background: linear-gradient(90deg, #10b981, #059669); box-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }
.progress-bar.warning { background: linear-gradient(90deg, #f59e0b, #d97706); box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.progress-bar.danger  { background: linear-gradient(90deg, #ef4444, #dc2626); box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }

@keyframes progressShine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ============================================================
   19. 工具类
   ============================================================ */
.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary  { color: var(--text-tertiary) !important; }
.text-success   { color: var(--success) !important; }
.text-error     { color: var(--error) !important; }
.text-warning   { color: var(--warning) !important; }
.text-info      { color: var(--info) !important; }
.text-accent    { color: var(--accent-1) !important; }

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-mono   { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-bold   { font-weight: 700; }
.text-sm     { font-size: 0.78rem; }
.text-lg     { font-size: 1.05rem; }
.text-xl     { font-size: 1.25rem; }
.text-2xl    { font-size: 1.5rem; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.5px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.my-3 { margin: 12px 0; }
.my-4 { margin: 16px 0; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.hidden { display: none !important; }
.block { display: block; }

.w-full { width: 100%; }
.min-w-0 { min-width: 0; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.relative { position: relative; }
.absolute { position: absolute; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shadow-glow { box-shadow: var(--shadow-glow); }

/* ============================================================
   20. 空状态
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-tertiary);
}

.empty-state .empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--bg-glass-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.empty-state .empty-icon svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

.empty-state h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ============================================================
   21. 标签页
   ============================================================ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 18px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-1);
    box-shadow: 0 2px 12px -2px var(--accent-glow);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   22. 分页
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.pagination .active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.pagination .disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    margin-left: 12px;
}

/* ============================================================
   23. 页脚
   ============================================================ */
.footer {
    padding: 16px var(--content-padding);
    border-top: 1px solid var(--border-light);
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text-tertiary);
    font-size: 0.75rem;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.footer a {
    color: var(--text-secondary);
}

.footer a:hover {
    color: var(--text-primary);
}

/* ============================================================
   24. 搜索框
   ============================================================ */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    stroke: var(--text-tertiary);
    fill: none;
    stroke-width: 2;
    pointer-events: none;
}

.search-box input {
    padding-left: 38px;
    width: 240px;
    max-width: 100%;
}

.search-box input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18), 0 0 16px rgba(99, 102, 241, 0.2);
}

/* ============================================================
   25. 响应式断点
   ============================================================ */
@media (max-width: 1280px) {
    .grid-cols-5 { grid-template-columns: repeat(4, 1fr); }
    .grid-cols-6 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
    .grid-cols-4,
    .grid-cols-5,
    .grid-cols-6 { grid-template-columns: repeat(3, 1fr); }

    :root {
        --content-padding: 20px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
        --content-padding: 16px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4,
    .grid-cols-5,
    .grid-cols-6 {
        grid-template-columns: 1fr;
    }

    .grid-auto-fit {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 14px;
        gap: 10px;
    }

    .topbar-title h1 { font-size: 1rem; }
    .topbar-title .page-desc { display: none; }

    .period-selector {
        padding: 4px 8px;
    }

    .period-selector label { display: none; }

    .user-info {
        display: none;
    }

    .user-toggle {
        padding: 4px;
    }

    .glass-card,
    .kpi-card {
        padding: 18px;
    }

    .card-body,
    .card-header {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions {
        justify-content: flex-start;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .table thead th,
    .table tbody td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .modal {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .topbar-title h1 { font-size: 0.95rem; }
    .kpi-value { font-size: 1.5rem; }
    .flash-container,
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }
}

/* ============================================================
   26. 登录 / 认证页
   ============================================================ */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
    z-index: 1;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    width: 100%;
    max-width: 940px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.18);
    overflow: hidden;
}

.auth-brand {
    padding: 44px 40px;
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.28) 0%, rgba(139, 92, 246, 0.14) 45%, rgba(6, 182, 212, 0.1) 100%);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: relative;
}

.auth-brand::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, transparent 70%);
    filter: blur(30px);
    pointer-events: none;
}

.auth-brand-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-brand-logo {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

.auth-brand-title {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.auth-brand-sub {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 3px;
}

.auth-brand-slogan {
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.5;
}

.auth-brand-slogan em {
    font-style: normal;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
}

.auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.auth-feature .af-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-3);
    flex-shrink: 0;
}

.auth-feature .af-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-feature strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.auth-panel {
    padding: 46px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card-head {
    margin-bottom: 26px;
}

.auth-card-title {
    color: var(--text-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-form .btn-block {
    margin-top: 10px;
}

.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.auth-links a {
    color: var(--text-secondary);
}

.auth-links a:hover {
    color: var(--text-primary);
}

.auth-hint {
    margin-top: 20px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.7;
}

.auth-hint strong {
    color: var(--text-primary);
}

@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 460px;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        padding: 34px 26px;
    }
}

/* ============================================================
   27. 凭证分录编辑
   ============================================================ */
.entry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.entry-table thead th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 11px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.entry-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.entry-table .col-idx { width: 44px; text-align: center; }
.entry-table .col-amount { width: 160px; }
.entry-table .col-del { width: 48px; text-align: center; }

.entry-table .form-control {
    padding: 8px 10px;
    font-size: 0.82rem;
}

.entry-table .amount-input {
    text-align: right;
    font-family: var(--font-mono);
}

.entry-row-remove {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-tertiary);
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.entry-row-remove:hover {
    color: var(--error);
    background: var(--error-bg);
    border-color: var(--error-border);
}

.entry-row-remove svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

.entry-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-top: 1px solid var(--border-light);
    background: rgba(10, 14, 39, 0.3);
}

.entry-totals {
    display: flex;
    gap: 26px;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.entry-totals .et-item {
    color: var(--text-muted);
}

.entry-totals .et-item b {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 1rem;
    margin-left: 6px;
}

.entry-totals .et-item.balanced b { color: var(--success); }
.entry-totals .et-item.unbalanced b { color: var(--error); }

.amount-words {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.amount-words b {
    color: var(--text-primary);
    letter-spacing: 1px;
}

/* ============================================================
   28. 通用小组件
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar .form-group {
    margin-bottom: 0;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-box.sm {
    height: 240px;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    text-align: center;
    padding: 20px;
}

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-glass-light);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.todo-item:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.todo-item .todo-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.todo-item.warning .todo-dot { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.todo-item.danger  .todo-dot { background: var(--error);   box-shadow: 0 0 8px var(--error); }
.todo-item.info    .todo-dot { background: var(--info);    box-shadow: 0 0 8px var(--info); }
.todo-item .todo-text { flex: 1; min-width: 0; }

.legend-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.83rem;
    color: var(--text-secondary);
}

.legend-item .legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-item .legend-name { flex: 1; min-width: 0; }

.legend-item .legend-val {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.stat-inline {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
}

.stat-inline .si-item {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stat-inline .si-item b {
    display: block;
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 1.15rem;
    margin-top: 2px;
}

.pager-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   29. 凭证打印
   ============================================================ */
.print-body {
    background: #fff;
    color: #111;
    min-height: 100vh;
    padding: 24px 16px 60px;
}

.print-toolbar {
    max-width: 900px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.print-page {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    color: #111;
    padding: 30px 34px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.vp-head {
    text-align: center;
    margin-bottom: 16px;
    position: relative;
}

.vp-head h1 {
    color: #111;
    font-size: 1.5rem;
    letter-spacing: 8px;
    font-weight: 700;
}

.vp-head .vp-sub {
    color: #444;
    font-size: 0.8rem;
    margin-top: 4px;
}

.vp-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8rem;
    color: #222;
    margin: 14px 0 8px;
    flex-wrap: wrap;
}

.vp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    color: #111;
}

.vp-table th,
.vp-table td {
    border: 1px solid #333;
    padding: 7px 9px;
    vertical-align: middle;
}

.vp-table thead th {
    background: #f2f2f2;
    color: #111;
    font-weight: 600;
    text-align: center;
    font-size: 0.78rem;
}

.vp-table .vp-num {
    text-align: right;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.vp-table .vp-center { text-align: center; }

.vp-table tfoot td {
    font-weight: 600;
    background: #fafafa;
}

.vp-words {
    margin-top: 10px;
    font-size: 0.82rem;
    color: #222;
}

.vp-sign {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-top: 18px;
    font-size: 0.8rem;
    color: #222;
    flex-wrap: wrap;
}

.vp-sign span { white-space: nowrap; }

.vp-void {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    font-size: 3.4rem;
    font-weight: 800;
    color: rgba(239, 68, 68, 0.28);
    letter-spacing: 12px;
    border: 4px solid rgba(239, 68, 68, 0.28);
    padding: 8px 26px;
    pointer-events: none;
}

/* 打印样式 */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    .print-body {
        padding: 0;
    }

    .print-toolbar {
        display: none !important;
    }

    .print-page {
        max-width: none;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .sidebar,
    .topbar,
    .footer,
    .sidebar-overlay,
    .flash-container,
    .toast-container {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .glass-card,
    .table-wrapper {
        background: #fff;
        border: 1px solid #ccc;
        box-shadow: none;
        backdrop-filter: none;
    }

    .table thead th {
        background: #f0f0f0;
        color: #000;
    }

    .table tbody td {
        color: #000;
    }
}

/* 减弱动画 - 用户偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body::before,
    body::after {
        animation: none;
    }
}
