/* ============================================
   陨云科技管理后台 - 统一设计系统 v2.0
   现代化 UI / 响应式 / 组件化
   ============================================ */

/* ---- 设计变量 ---- */
:root {
    /* 主题色 */
    --primary: #4f6ef7;
    --primary-light: #6c8aff;
    --primary-dark: #3b54e0;
    --primary-bg: rgba(79, 110, 247, 0.08);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #0ea5e9;
    --info-bg: rgba(14, 165, 233, 0.1);

    /* 中性色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* 阴影 */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);

    /* 间距 */
    --sidebar-w: 250px;
    --header-h: 60px;

    /* 过渡 */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- 全局重置 ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Noto Sans SC", sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- 侧边栏 ---- */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 0;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #818cf8, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #38bdf8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-menu {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-bottom: 3px;
    color: rgba(255,255,255,0.6);
    transition: all var(--transition);
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    text-decoration: none;
    role: link;
}
.menu-item:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: -2px;
}

.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.9);
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 110, 247, 0.35);
}

.menu-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer .menu-item {
    color: rgba(255,255,255,0.45);
}

.sidebar-footer .menu-item:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ---- 主内容区 ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    background: var(--bg-card);
    padding: 0 28px;
    height: var(--header-h);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-xs);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.breadcrumb {
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb a:hover { text-decoration: underline; }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary), #38bdf8);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.content {
    padding: 24px 28px;
    flex: 1;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* ---- 卡片 ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-title {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-content {
    padding: 24px;
}

/* ---- 按钮 ---- */
.btn {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border: none;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(79,110,247,0.3); }

.btn-default {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-default:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #dc2626; box-shadow: 0 2px 8px rgba(239,68,68,0.3); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 表格 ---- */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

th {
    background: var(--bg-hover);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

td { color: var(--text-secondary); }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }

/* ---- 表单 ---- */
input, select, textarea {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label .required { color: var(--danger); }

.form-control {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    transition: all var(--transition);
    font-family: inherit;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}
.form-error.show { display: block; }

input[type="file"] { padding: 0; border: none; }

/* ---- 状态标签 ---- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-offline { background: var(--text-tertiary); }

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}
.tag-success { background: var(--success-bg); color: var(--success); }
.tag-warning { background: var(--warning-bg); color: var(--warning); }
.tag-error { background: var(--danger-bg); color: var(--danger); }
.tag-info { background: var(--info-bg); color: var(--info); }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    background: var(--danger);
}
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); }
.badge-info { background: var(--info); }

.status-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}
.status-tag-success { background: var(--success-bg); color: var(--success); }
.status-tag-warning { background: var(--warning-bg); color: var(--warning); }
.status-tag-error { background: var(--danger-bg); color: var(--danger); }

/* ---- 筛选栏 ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.search-box {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    width: 220px;
    transition: all var(--transition);
}

.search-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }

.filter-select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
}

/* ---- 分页 ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.page-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
}
.page-btn:hover:not(.active):not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- 模态框 ---- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}
.modal.show { display: flex; }

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 20px 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

/* ---- 通知图标 ---- */
.notification { position: relative; cursor: pointer; }
.notification-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* ---- 进度条 ---- */
.progress {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ---- Toast 通知 ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 280px;
    max-width: 400px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease-out;
    pointer-events: auto;
    cursor: pointer;
}

@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%); }
}

.toast.removing { animation: toastOut 0.3s ease-in forwards; }

.toast-success { background: #fff; border-left: 4px solid var(--success); color: var(--text-primary); }
.toast-error { background: #fff; border-left: 4px solid var(--danger); color: var(--text-primary); }
.toast-warning { background: #fff; border-left: 4px solid var(--warning); color: var(--text-primary); }
.toast-info { background: #fff; border-left: 4px solid var(--info); color: var(--text-primary); }

.toast-icon { font-size: 18px; flex-shrink: 0; }

/* ---- Loading 加载 ---- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(241, 245, 249, 0.7);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 14px; color: var(--text-secondary); }

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line { height: 16px; margin-bottom: 10px; }
.skeleton-line:last-child { margin-bottom: 0; width: 60%; }

/* 内联 loading */
.inline-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-tertiary);
    font-size: 14px;
}
.inline-loading::before {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ---- 空状态 ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 14px; }

/* ---- 确认对话框 ---- */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.confirm-overlay.show { display: flex; }

.confirm-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

.confirm-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.confirm-icon.warning { background: var(--warning-bg); color: var(--warning); }
.confirm-icon.danger { background: var(--danger-bg); color: var(--danger); }
.confirm-icon.info { background: var(--info-bg); color: var(--info); }

.confirm-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.confirm-message { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- 响应式 ---- */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
}

@media (max-width: 1024px) {
    .stats-grid, .data-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; align-items: center; }
    .content { padding: 16px; }
    .header { padding: 0 16px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-box { width: 100%; }
    .page-title { font-size: 18px; }
    .card-content { padding: 16px; }
    th, td { padding: 8px 10px; font-size: 13px; }
    .user-info span { display: none; }
    .toast { min-width: calc(100vw - 40px); }
}

/* 移动端遮罩 */
.sidebar-mask {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.sidebar-mask.show { display: block; }

/* ---- 跳到主内容（无障碍） ---- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    z-index: 10000;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: top var(--transition);
}
.skip-link:focus {
    top: 8px;
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* ---- WCAG 焦点样式 ---- */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:focus-visible,
.menu-item:focus-visible,
.page-btn:focus-visible,
.form-control:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.search-box:focus-visible,
.filter-select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ---- 屏幕阅读器专用 ---- */
.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;
}

/* ---- 面包屑导航 ---- */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.breadcrumb-nav ol {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.breadcrumb-nav li {
    display: flex;
    align-items: center;
    gap: 4px;
}
.breadcrumb-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.breadcrumb-nav a:hover {
    color: var(--primary);
    background: var(--primary-bg);
}
.breadcrumb-nav .breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
    padding: 4px 8px;
}
.breadcrumb-nav .breadcrumb-separator {
    color: var(--text-tertiary);
    user-select: none;
}

/* ---- 表格密度变体 ---- */
.table-compact th,
.table-compact td {
    padding: 8px 12px;
    font-size: 13px;
}
.table-compact th {
    font-size: 12px;
}

.table-comfortable th,
.table-comfortable td {
    padding: 16px 20px;
}

/* 表格排序指示器 */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px;
}
th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-tertiary);
    opacity: 0.5;
}
th.sortable.sort-asc::after { content: '↑'; opacity: 1; color: var(--primary); }
th.sortable.sort-desc::after { content: '↓'; opacity: 1; color: var(--primary); }

/* 表格容器（支持水平滚动） */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}
.table-wrapper table {
    min-width: 600px;
}

/* 表格行选中 */
tbody tr.selected {
    background: var(--primary-bg);
}
tbody tr.selected:hover {
    background: rgba(79, 110, 247, 0.12);
}

/* ---- 增强空状态 ---- */
.empty-state-enhanced {
    text-align: center;
    padding: 60px 24px;
}
.empty-state-enhanced .empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.empty-state-enhanced .empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.empty-state-enhanced .empty-desc {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}
.empty-state-enhanced .empty-action {
    margin-top: 4px;
}

/* ---- 增强错误状态 ---- */
.error-state {
    text-align: center;
    padding: 48px 24px;
}
.error-state .error-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--danger-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}
.error-state .error-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.error-state .error-desc {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

/* ---- 骨架屏表格 ---- */
.skeleton-table th,
.skeleton-table td {
    padding: 12px 16px;
}
.skeleton-table .skeleton {
    height: 16px;
    border-radius: var(--radius-sm);
}

/* ---- 表单增强 ---- */
.form-group.has-error .form-control,
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: var(--danger);
}
.form-group.has-error .form-control:focus,
.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.form-group.has-success .form-control,
.form-group.has-success input,
.form-group.has-success select {
    border-color: var(--success);
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* 表单必填标记 */
.form-label .required,
.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

/* 输入框带图标 */
.input-with-icon {
    position: relative;
}
.input-with-icon input {
    padding-left: 40px;
}
.input-with-icon .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
}

/* ---- 卡片增强 ---- */
.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
}
.card-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---- 统计卡片增强 ---- */
.stat-card-enhanced {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card-enhanced .stat-icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-card-enhanced .stat-icon-box.blue { background: var(--primary-bg); color: var(--primary); }
.stat-card-enhanced .stat-icon-box.green { background: var(--success-bg); color: var(--success); }
.stat-card-enhanced .stat-icon-box.orange { background: var(--warning-bg); color: var(--warning); }
.stat-card-enhanced .stat-icon-box.red { background: var(--danger-bg); color: var(--danger); }
.stat-card-enhanced .stat-info {
    flex: 1;
}
.stat-card-enhanced .stat-value-large {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}
.stat-card-enhanced .stat-label-small {
    font-size: 13px;
    color: var(--text-tertiary);
}
.stat-card-enhanced .stat-trend {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}
.stat-card-enhanced .stat-trend.up { color: var(--success); background: var(--success-bg); }
.stat-card-enhanced .stat-trend.down { color: var(--danger); background: var(--danger-bg); }

/* ---- ARIA live region（通知给屏幕阅读器） ---- */
.aria-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- 高对比度模式支持 ---- */
@media (prefers-contrast: high) {
    :root {
        --border: #666;
        --border-light: #999;
        --text-secondary: #333;
        --text-tertiary: #555;
    }
    .btn { border: 2px solid currentColor; }
    .card { border: 2px solid var(--border); }
}

/* ---- 减少动画（尊重用户偏好） ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .loading-spinner { animation: spin 2s linear infinite; }
}

/* ---- 打印样式 ---- */
@media print {
    .sidebar, .header, .filter-bar, .pagination, .quick-links, .toast-container, .loading-overlay, .modal, .modal-overlay, .confirm-overlay {
        display: none !important;
    }
    .main-content { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ---- 工具类 ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-tertiary); }
.font-bold { font-weight: 600; }
.font-medium { font-weight: 500; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.w-full { width: 100%; }
.w-auto { width: auto; }
.hidden { display: none; }
.cursor-pointer { cursor: pointer; }
.relative { position: relative; }
.absolute { position: absolute; }
.overflow-hidden { overflow: hidden; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 16px; }
.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
