/* ============================================================
   焰圈会员卡管理系统 - 2026 全面美化版
   设计理念：现代极简 · 柔和友好 · 响应式优先
   ============================================================ */

/* ---- CSS 变量 ---- */
:root {
    /* 品牌主色 */
    --primary: #2A7DE1;
    --primary-dark: #1E68C4;
    --primary-darker: #1753A3;
    --primary-light: #5BA0F5;
    --primary-lighter: #A8CDFA;
    --primary-ghost: #EBF3FD;
    --primary-gradient: linear-gradient(135deg, #1E68C4 0%, #2A7DE1 50%, #5BA0F5 100%);

    /* 功能色 */
    --success: #10B981;
    --success-dark: #059669;
    --success-light: #D1FAE5;
    --success-ghost: #ECFDF5;
    --warning: #F59E0B;
    --warning-dark: #D97706;
    --warning-light: #FEF3C7;
    --warning-ghost: #FFFBEB;
    --danger: #EF4444;
    --danger-dark: #DC2626;
    --danger-light: #FEE2E2;
    --danger-ghost: #FEF2F2;

    /* 中性色 */
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-hint: #CBD5E1;
    --text-placeholder: #94A3B8;
    --bg-page: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-hover: #F8FAFC;
    --bg-active: #EFF6FF;
    --border-light: #E2E8F0;
    --border-base: #CBD5E1;
    --border-dark: #94A3B8;

    /* 阴影（柔和层级） */
    --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 rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.1), 0 10px 25px rgba(0, 0, 0, 0.06);
    --shadow-btn-primary: 0 2px 8px rgba(42, 125, 225, 0.3);
    --shadow-btn-primary-hover: 0 4px 14px rgba(42, 125, 225, 0.4);

    /* 圆角 */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* 间距梯度 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    /* 字体大小 */
    --text-xs: 0.7rem;
    --text-sm: 0.78rem;
    --text-base: 0.88rem;
    --text-md: 0.95rem;
    --text-lg: 1.05rem;
    --text-xl: 1.2rem;
    --text-2xl: 1.4rem;
    --text-3xl: 1.6rem;
    --text-4xl: 1.8rem;

    /* 布局 */
    --sidebar-width: 240px;
    --header-height: 56px;

    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ---- 全局基础 ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    margin: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- 布局容器 ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- 侧边栏 ---- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.app-sidebar::-webkit-scrollbar {
    width: 4px;
}
.app-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-base);
    border-radius: var(--radius-full);
}
.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.app-sidebar .brand img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    object-fit: cover;
}

.app-sidebar .brand span {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.app-sidebar .nav-section {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.app-sidebar .nav-header {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 14px 16px 6px;
    user-select: none;
}

.app-sidebar .nav-item {
    display: block;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 1px 8px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: var(--text-base);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
}

.app-sidebar .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.app-sidebar .nav-link.active {
    background: var(--primary-ghost);
    color: var(--primary);
    font-weight: 600;
}

.app-sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--primary);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.app-sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.75;
}

.app-sidebar .nav-link.active i {
    opacity: 1;
}

/* ---- 主内容区 ---- */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    min-width: 0;
}

/* ---- 顶栏 ---- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.app-header .toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-header .toggle-sidebar:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.app-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-header .identity-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--primary-ghost);
    color: var(--primary);
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
}

.app-header .user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-base);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 12px 4px 6px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    position: relative;
    user-select: none;
}
/* 用伪元素在下拉菜单上方搭桥，消除 hover 间隙 */
.app-header .user-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.app-header .user-dropdown:hover {
    background: var(--bg-hover);
}

.app-header .user-dropdown .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.app-header .user-dropdown .avatar-fallback {
    background: var(--text-muted);
}

.app-header .dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1050;
    min-width: 200px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    padding: 6px 0;
    display: none;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


.app-header .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: var(--text-base);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.app-header .dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.app-header .dropdown-item.text-danger {
    color: var(--danger);
}
.app-header .dropdown-item.text-danger:hover {
    background: var(--danger-ghost);
    color: var(--danger);
}

.app-header .dropdown-divider {
    margin: 4px 0;
    border-top: 1px solid var(--border-light);
}

.app-header .dropdown-item-text {
    padding: 6px 16px 2px;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---- 内容区 ---- */
.app-content {
    flex: 1;
    padding: 24px 24px 32px;
    min-width: 0;
}

/* ---- 页面标题 ---- */
.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.page-title i {
    color: var(--primary);
    font-size: 0.9em;
}

/* ---- 卡片 ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h6,
.card-header .card-title {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 20px;
}

.card-body.p-0 {
    padding: 0;
}

.card-footer {
    padding: 12px 20px;
    background: var(--bg-page);
    border-top: 1px solid var(--border-light);
}

/* 颜色边框卡片 */
.card-primary {
    border-left: 4px solid var(--primary);
}
.card-success {
    border-left: 4px solid var(--success);
}
.card-warning {
    border-left: 4px solid var(--warning);
}
.card-danger {
    border-left: 4px solid var(--danger);
}
.card-info {
    border-left: 4px solid var(--primary);
}

/* ---- 统计卡片 ---- */
.stat-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    position: relative;
    padding: 20px 20px 20px 24px;
    background: var(--bg-card);
    transition: all var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card .icon {
    font-size: 2.4rem;
    opacity: 0.08;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    transition: all var(--transition-base);
}

.stat-card:hover .icon {
    opacity: 0.12;
    transform: translateY(-50%) scale(1.05);
}

.stat-card .number {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card .label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.stat-card.primary .number,
.card-primary .number {
    color: var(--primary);
}
.stat-card.success .number,
.card-success .number {
    color: var(--success);
}
.stat-card.danger .number,
.card-danger .number {
    color: var(--danger);
}
.stat-card.warning .number,
.card-warning .number {
    color: var(--warning);
}
.card-info .number {
    color: var(--primary);
}

/* 颜色卡片图标 */
.card-primary .icon,
.card-info .icon {
    color: var(--primary);
}
.card-success .icon {
    color: var(--success);
}
.card-warning .icon {
    color: var(--warning);
}
.card-danger .icon {
    color: var(--danger);
}

/* ---- info-box（Dashboard 兼容） ---- */
.info-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 18px 20px;
    min-height: 80px;
    gap: 14px;
    transition: all var(--transition-base);
}

.info-box:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.info-box-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.info-box-icon.bg-primary,
.info-box-icon.bg-info {
    background: var(--primary);
}
.info-box-icon.bg-success {
    background: var(--success);
}
.info-box-icon.bg-warning {
    background: var(--warning);
}
.info-box-icon.bg-danger {
    background: var(--danger);
}
.info-box-icon.bg-secondary {
    background: var(--text-muted);
}

.info-box-content {
    flex: 1;
    min-width: 0;
}

.info-box-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.info-box-number {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ---- 按钮系统 ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: var(--text-base);
    font-weight: 600;
    padding: 8px 18px;
    border-radius: var(--radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    -webkit-appearance: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn:focus-visible {
    outline: 2px solid var(--primary-lighter);
    outline-offset: 2px;
}

/* 主要按钮 */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-btn-primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-btn-primary-hover);
}

.btn-primary:active {
    background: var(--primary-darker);
}

/* 成功按钮 */
.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: var(--success-dark);
    border-color: var(--success-dark);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

/* 危险按钮 */
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: var(--danger-dark);
    border-color: var(--danger-dark);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

/* 警告按钮 */
.btn-warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
    background: var(--warning-dark);
    border-color: var(--warning-dark);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

/* 次要按钮 / 默认按钮 */
.btn-secondary,
.btn-outline-secondary,
.btn-default {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border-base);
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-default:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-dark);
}

/* 描边按钮 */
.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary-ghost);
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-info {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary-lighter);
}

.btn-outline-info:hover {
    background: var(--primary-ghost);
    color: var(--primary-dark);
    border-color: var(--primary);
}

/* Info 按钮 */
.btn-info {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-info:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Light 按钮 */
.btn-light {
    background: var(--bg-page);
    color: var(--text-secondary);
    border-color: var(--border-light);
}

.btn-light:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* 文字按钮 */
.btn-text {
    background: transparent;
    color: var(--primary);
    border-color: transparent;
    padding-left: 8px;
    padding-right: 8px;
}

.btn-text:hover {
    background: var(--primary-ghost);
}

.btn-text.btn-danger {
    color: var(--danger);
}
.btn-text.btn-danger:hover {
    background: var(--danger-ghost);
}

/* 按钮尺寸 */
.btn-xs {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    line-height: 1.5;
}

.btn-sm {
    font-size: var(--text-sm);
    padding: 5px 14px;
}

.btn-lg {
    font-size: var(--text-lg);
    padding: 10px 24px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn i,
.btn .fa,
.btn .fas,
.btn .far {
    font-size: 0.9em;
    margin-right: 4px;
}
.btn i:last-child,
.btn .fa:last-child,
.btn .fas:last-child,
.btn .far:last-child {
    margin-right: 0;
}

/* 表格操作按钮组 */
.table-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.table-actions .btn {
    white-space: nowrap;
}

/* 表格操作按钮响应式：小屏隐藏文字只显示图标 */
@media (max-width: 767.98px) {
    .table-actions .btn .btn-label {
        display: none;
    }
    .table-actions .btn i {
        margin-right: 0;
    }
    .table-actions .btn {
        padding: 5px 8px;
    }
}

/* 禁用态 */
.btn:disabled,
.btn.disabled {
    opacity: 0.45;
    pointer-events: none;
    box-shadow: none;
    cursor: not-allowed;
}

/* Loading 按钮 */
.btn-loading {
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
    margin-right: 4px;
}

@keyframes btnSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- 表格 ---- */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.table th {
    padding: 10px 14px;
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--bg-page);
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table th:first-child {
    border-radius: var(--radius) 0 0 0;
}
.table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-active);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-sm th,
.table-sm td {
    padding: 8px 10px;
}

.table-striped tbody tr:nth-child(even) {
    background: rgba(241, 245, 249, 0.6);
}

.table-striped tbody tr:nth-child(even):hover {
    background: var(--bg-active);
}

.table-hover tbody tr:hover {
    background: var(--bg-active);
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

.table .text-right {
    text-align: right;
}
.table .text-center {
    text-align: center;
}
.table .text-muted {
    color: var(--text-muted);
}

/* 表格内操作按钮 */
.table .btn {
    margin: 0 2px;
}

/* ---- Badge / 标签 ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.5;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-ghost);
    color: var(--success-dark);
    border: 1px solid var(--success-light);
}
.badge-danger {
    background: var(--danger-ghost);
    color: var(--danger-dark);
    border: 1px solid var(--danger-light);
}
.badge-warning {
    background: var(--warning-ghost);
    color: var(--warning-dark);
    border: 1px solid var(--warning-light);
}
.badge-info,
.badge-primary {
    background: var(--primary-ghost);
    color: var(--primary-dark);
    border: 1px solid rgba(42, 125, 225, 0.15);
}
.badge-secondary {
    background: var(--bg-page);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

/* ---- 表单 ---- */
.form-control {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: var(--text-base);
    color: var(--text-primary);
    line-height: 1.5;
    background: var(--bg-card);
    border: 1.5px solid var(--border-base);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    -webkit-appearance: none;
    font-family: inherit;
}

.form-control:hover {
    border-color: var(--border-dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42, 125, 225, 0.1);
}

.form-control::placeholder {
    color: var(--text-placeholder);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--bg-page);
    cursor: not-allowed;
}

.form-control-sm {
    padding: 5px 10px;
    font-size: var(--text-sm);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 4px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* 表单校验状态 */
.form-control.is-invalid {
    border-color: var(--danger);
}
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.invalid-feedback {
    color: var(--danger);
    font-size: var(--text-xs);
    margin-top: 4px;
}

/* ---- Alert ---- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: var(--text-base);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert i:first-child {
    margin-top: 2px;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-ghost);
    color: #065F46;
    border-color: var(--success-light);
}
.alert-danger {
    background: var(--danger-ghost);
    color: #991B1B;
    border-color: var(--danger-light);
}
.alert-warning {
    background: var(--warning-ghost);
    color: #92400E;
    border-color: var(--warning-light);
}
.alert-info,
.alert-primary {
    background: var(--primary-ghost);
    color: var(--primary-dark);
    border-color: rgba(42, 125, 225, 0.15);
}

.alert-dismissible {
    position: relative;
    padding-right: 44px;
}

.alert-dismissible .close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: opacity var(--transition-fast);
}

.alert-dismissible .close:hover {
    opacity: 1;
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: var(--text-base);
    font-weight: 600;
    color: #fff;
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastIn 0.25s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.bg-success {
    background: var(--success);
}
.toast.bg-danger {
    background: var(--danger);
}

/* ---- 加载遮罩 ---- */
#loading-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(241, 245, 249, 0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.spinner-border {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Modal 弹窗 ---- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1055;
    display: none;
}

.modal.show {
    display: block;
}

.modal.fade .modal-dialog {
    transform: translateY(-20px);
    opacity: 0;
    transition: all var(--transition-base);
}

.modal.fade.show .modal-dialog {
    transform: translateY(0);
    opacity: 1;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1054;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal-dialog {
    position: relative;
    z-index: 1056;
    max-width: 520px;
    margin: 60px auto 0;
    pointer-events: auto;
}

.modal-dialog.modal-sm {
    max-width: 380px;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-dialog.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 60px);
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    width: 100%;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h5,
.modal-header .modal-title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.modal-header .close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
}

.modal-header .close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-body {
    padding: 22px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-page);
}

/* ---- 分页 ---- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 0;
    list-style: none;
    margin: 0;
}

.page-item {
    display: inline-flex;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.page-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
    border-color: var(--primary-lighter);
}

.page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(42, 125, 225, 0.3);
}

.page-item.disabled .page-link {
    color: var(--text-hint);
    pointer-events: none;
    background: var(--bg-page);
    border-color: var(--border-light);
}

/* ---- 空状态 ---- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state .empty-text {
    font-size: var(--text-base);
    margin-bottom: 4px;
}

.empty-state .empty-hint {
    font-size: var(--text-sm);
    color: var(--text-hint);
}

/* ---- 图表容器 ---- */
canvas {
    max-width: 100%;
}

/* ---- 文字颜色覆盖 ---- */
.text-primary {
    color: var(--primary) !important;
}
.text-success {
    color: var(--success) !important;
}
.text-danger {
    color: var(--danger) !important;
}
.text-warning {
    color: var(--warning) !important;
}
.text-info {
    color: var(--primary) !important;
}
.text-muted {
    color: var(--text-muted) !important;
}
.text-secondary {
    color: var(--text-secondary) !important;
}

/* ---- 背景色覆盖 ---- */
.bg-primary {
    background-color: var(--primary) !important;
}
.bg-success {
    background-color: var(--success) !important;
}
.bg-danger {
    background-color: var(--danger) !important;
}
.bg-warning {
    background-color: var(--warning) !important;
}
.bg-info {
    background-color: var(--primary) !important;
}
.bg-secondary {
    background-color: var(--text-muted) !important;
}
.bg-light {
    background-color: var(--bg-page) !important;
}
.bg-white {
    background-color: #fff !important;
}

/* ---- 实用工具类 ---- */
.clickable {
    cursor: pointer;
    transition: opacity var(--transition-fast);
}
.clickable:hover {
    opacity: 0.8;
}
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 间距 */
.m-0 {
    margin: 0 !important;
}
.mt-1 {
    margin-top: 6px;
}
.mt-2 {
    margin-top: 12px;
}
.mt-3 {
    margin-top: 20px;
}
.mt-4 {
    margin-top: 28px;
}
.mb-0 {
    margin-bottom: 0;
}
.mb-1 {
    margin-bottom: 6px;
}
.mb-2 {
    margin-bottom: 12px;
}
.mb-3 {
    margin-bottom: 20px;
}
.mb-4 {
    margin-bottom: 28px;
}
.mr-1 {
    margin-right: 6px;
}
.mr-2 {
    margin-right: 10px;
}
.ml-1 {
    margin-left: 6px;
}
.ml-2 {
    margin-left: 10px;
}
.ml-auto {
    margin-left: auto;
}
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}
.p-0 {
    padding: 0;
}
.p-2 {
    padding: 12px;
}
.p-3 {
    padding: 20px;
}
.py-1 {
    padding-top: 6px;
    padding-bottom: 6px;
}
.py-2 {
    padding-top: 12px;
    padding-bottom: 12px;
}
.py-3 {
    padding-top: 20px;
    padding-bottom: 20px;
}
.px-2 {
    padding-left: 12px;
    padding-right: 12px;
}
.px-3 {
    padding-left: 20px;
    padding-right: 20px;
}

/* 文字 */
.text-center {
    text-align: center;
}
.text-right {
    text-align: right;
}
.text-left {
    text-align: left;
}
.font-bold {
    font-weight: 700;
}
.font-semibold {
    font-weight: 600;
}
.small {
    font-size: var(--text-sm);
}

/* 显示/隐藏 */
.d-none {
    display: none !important;
}
.d-flex {
    display: flex;
}
.d-inline-flex {
    display: inline-flex;
}
.d-block {
    display: block;
}
.d-inline-block {
    display: inline-block;
}

/* Flex 工具 */
.align-items-center {
    align-items: center;
}
.justify-content-between {
    justify-content: space-between;
}
.justify-content-center {
    justify-content: center;
}
.justify-content-end {
    justify-content: flex-end;
}
.flex-wrap {
    flex-wrap: wrap;
}
.flex-1 {
    flex: 1;
    min-width: 0;
}
.gap-2 {
    gap: 8px;
}
.gap-3 {
    gap: 12px;
}

/* 宽度 */
.w-100 {
    width: 100%;
}
.w-auto {
    width: auto;
}
.w-36 {
    width: 36px;
}
.w-60 {
    width: 60px;
}

/* 最小宽度 */
.min-w-80 {
    min-width: 80px;
}
.min-w-100 {
    min-width: 100px;
}
.min-w-120 {
    min-width: 120px;
}
.min-w-140 {
    min-width: 140px;
}
.min-w-180 {
    min-width: 180px;
}

/* 最大宽度 */
.max-w-80 {
    max-width: 80px;
}
.max-w-100 {
    max-width: 100px;
}
.max-w-200 {
    max-width: 200px;
}

/* 最大高度 */
.max-h-250 {
    max-height: 250px;
}
.max-h-300 {
    max-height: 300px;
}
.min-h-250 {
    min-height: 250px;
}

/* 滚动 */
.scroll-y-auto {
    overflow-y: auto;
}

/* 文字颜色 */
.text-white {
    color: #fff !important;
}
.text-hint {
    color: var(--text-hint) !important;
}

/* 文字换行 */
.ws-pre-wrap {
    white-space: pre-wrap;
}

/* 等宽字体 */
.font-mono {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* 文字大小 */
.text-xs {
    font-size: var(--text-xs);
}

/* ---- 侧边栏遮罩（移动端） ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1035;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity var(--transition-base);
}

/* ---- 移动端底部导航（可选） ---- */
.mobile-bottom-nav {
    display: none;
}

/* ---- 登录页 ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F1F5F9 0%, #E2E8F0 100%);
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .login-logo img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.login-card .login-logo h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.login-card .login-logo p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 4px 0 0;
}

/* ---- 底部 ---- */
.app-footer {
    padding: 12px 24px;
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* ============================================================
   响应式布局
   ============================================================ */

/* 平板 / 手机端（≤991px） */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .app-header {
        padding: 0 14px;
    }

    .app-header .identity-badge {
        display: none;
    }

    .app-content {
        padding: 16px 14px 24px;
    }

    /* 卡片 */
    .card-header {
        padding: 12px 16px;
    }
    .card-body {
        padding: 16px;
    }

    /* 弹窗 */
    .modal-dialog {
        margin: 20px 12px;
        max-width: none;
    }
    .modal-body {
        max-height: 55vh;
    }

    /* 表格横向滚动 */
    .table-responsive table {
        min-width: 600px;
    }

    /* 统计卡片 */
    .stat-card {
        padding: 16px;
    }
    .stat-card .number {
        font-size: var(--text-2xl);
    }
    .stat-card .icon {
        font-size: 1.8rem;
    }

    /* 按钮在移动端 */
    .btn-sm-block {
        display: flex;
        width: 100%;
        margin-bottom: 8px;
    }

    /* 分页 */
    .page-link {
        min-width: 32px;
        height: 32px;
        font-size: var(--text-sm);
    }

    /* 隐藏桌面端专属 */
    .d-none-mobile {
        display: none !important;
    }

    /* 移动端底部导航 */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1020;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border-light);
        padding: 4px 0;
        padding-bottom: env(safe-area-inset-bottom, 4px);
    }

    .mobile-bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6px 4px;
        color: var(--text-muted);
        font-size: var(--text-xs);
        text-decoration: none;
        transition: color var(--transition-fast);
        gap: 2px;
    }

    .mobile-bottom-nav .nav-item i {
        font-size: 1.15rem;
    }

    .mobile-bottom-nav .nav-item.active {
        color: var(--primary);
    }

    /* 有底部导航时内容区留出间距 */
    .has-bottom-nav .app-content {
        padding-bottom: 80px;
    }
}

/* 桌面端 */
@media (min-width: 992px) {
    .d-none-desktop {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: none !important;
    }
}

/* 小手机（≤575px） */
@media (max-width: 575.98px) {
    html {
        font-size: 14px;
    }

    .app-content {
        padding: 12px 10px 20px;
    }

    .card {
        border-radius: var(--radius);
        margin-bottom: 12px;
    }

    .page-title {
        font-size: var(--text-lg);
        margin-bottom: 12px;
    }

    .modal-dialog {
        margin: 12px 6px;
    }

    .login-card {
        padding: 28px 20px;
    }

    .table th,
    .table td {
        padding: 8px 10px;
    }
}

/* 大桌面（≥1200px） */
@media (min-width: 1200px) {
    .app-content {
        max-width: 1200px;
        margin: 0 auto;
        width: 100%;
    }
}
