/* ========== CSS 变量与重置 ========== */
:root {
    --primary: #3F5BD9;
    --primary-dark: #3348AE;
    --primary-light: #EBEFFC;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --info: #0891B2;
    --bg: #F4F6FA;
    --bg-white: #FFFFFF;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border: #E4E9F2;
    --card-line: #E4E9F2;
    --surface-soft: #F8FAFC;
    --surface-soft-2: #F1F5F9;
    --row-hover: #F7F9FC;
    --on-primary: #FFFFFF;

    /* 侧栏（方案 A：深色导航，内容区成为主角） */
    --side-bg: #1E2A4A;
    --side-line: #2B3859;
    --side-text: #A7B2C9;
    --side-text-dim: #6C7A99;
    --side-active-bg: rgba(255,255,255,0.10);
    --side-active-text: #FFFFFF;

    --shadow: 0 1px 2px rgba(16,24,40,0.04);
    --shadow-lg: 0 12px 28px rgba(16,24,40,0.10);
    --radius: 8px;
    --radius-lg: 10px;
    --transition: all 0.2s ease;
    --num-font: 'DIN Alternate', 'SF Mono', 'Roboto Mono', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== 登录页 ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-card h1 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text);
}
.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}
.link {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
}
.link:hover {
    text-decoration: underline;
}
.login-card .form-group { margin-bottom: 20px; }
.login-card label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: var(--text); }
.login-card .error-msg { color: var(--danger); font-size: 13px; margin-bottom: 16px; text-align: center; }

/* ========== 主布局 ========== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: var(--side-bg);
    border-right: 1px solid var(--side-line);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}
.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--side-line);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-header .logo {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-primary);
    font-size: 18px;
    font-weight: bold;
}
.sidebar-header h2 { font-size: 15px; color: #EAF0FF; letter-spacing: .2px; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section { margin-bottom: 8px; }
.nav-section-title {
    padding: 10px 12px 6px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--side-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.9px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--side-text);
    font-size: 13.5px;
    margin-bottom: 2px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.nav-item:hover { background: var(--side-active-bg); color: var(--side-active-text); }
.nav-item.active { background: var(--side-active-bg); color: var(--side-active-text); font-weight: 600; }
.nav-item .icon { font-size: 18px; width: 20px; text-align: center; }
.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--side-line);
}
.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
}
.sidebar-footer .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}
.sidebar-footer .user-name { font-size: 13px; font-weight: 500; color: #E4EBF7; }
.sidebar-footer .user-role { font-size: 11px; color: #8A97B3; }
.logout-btn {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--side-line);
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--side-text);
    transition: var(--transition);
    margin-top: 8px;
}
.logout-btn:hover { background: rgba(220,38,38,.16); color: #FFC9C9; border-color: rgba(220,38,38,.5); }

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
    min-height: 100vh;
}

/* ========== 页面标题 ========== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 600; }
.page-header .actions { display: flex; gap: 8px; }

/* ========== 卡片 ========== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-lg);
    box-shadow: none;
    padding: 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: var(--on-primary); }
.btn-success:hover { opacity: 0.9; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: var(--bg-white); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text); }
.form-group label .required { color: var(--danger); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-white);
    font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ========== 表格 ========== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
table th {
    background: var(--surface-soft);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
table tr:hover td { background: var(--row-hover); }
.table-actions { display: flex; gap: 4px; }
.empty-row td { text-align: center; padding: 40px; color: var(--text-secondary); }

/* ========== 状态标签 ========== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-active { background: #DCFCE7; color: #166534; }
.badge-disabled { background: #FEE2E2; color: #991B1B; }
.badge-draft { background: #FEF3C7; color: #92400E; }
.badge-calculated { background: #DBEAFE; color: #1E40AF; }
.badge-confirmed { background: #DCFCE7; color: #166534; }
.badge-paid { background: #DDD6FE; color: #5B21B6; }
.badge-pending { background: #F3F4F6; color: #4B5563; }
.badge-resigned { background: #FEE2E2; color: #991B1B; }
/* 批次修改日志 */
.badge-create { background: #DBEAFE; color: #1E40AF; }
.badge-generate { background: #DBEAFE; color: #1E40AF; }
.badge-update_detail { background: #FEF3C7; color: #92400E; }
.badge-add_benefit { background: #DCFCE7; color: #166534; }
.badge-update_benefit { background: #FEF3C7; color: #92400E; }
.badge-delete_benefit { background: #FEE2E2; color: #991B1B; }
.badge-apply_rule { background: #DBEAFE; color: #1E40AF; }
.badge-confirm { background: #DCFCE7; color: #166534; }
.badge-pay { background: #DDD6FE; color: #5B21B6; }

/* ========== 标签页 ========== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ========== 模态框 ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
}
.modal-lg { max-width: 800px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 1;
}
.modal-header h3 { font-size: 16px; }
.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: var(--surface-soft-2);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: white; }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--bg-white);
}

/* ========== 统计卡片 ========== */
.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.stat-card h4 { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; margin: 0; }
.stat-card .stat-value,
.stat-value {
    font-family: var(--num-font);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.stat-card .stat-info h4 { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.stat-card .stat-info .stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.stat-icon.blue { background: #EFF6FF; color: #3B82F6; }
.stat-icon.green { background: #F0FDF4; color: #22C55E; }
.stat-icon.orange { background: #FFF7ED; color: #F97316; }
.stat-icon.purple { background: #FAF5FF; color: #A855F7; }
.stat-icon.red { background: #FEF2F2; color: #EF4444; }

/* ========== 搜索/过滤 ========== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 160px; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-secondary); margin: 0 12px; }

/* ========== 工资编辑器 ========== */
.commission-editor {
    background: var(--surface-soft);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.commission-editor .form-row { margin-bottom: 12px; }
.benefit-list { margin-bottom: 12px; }
.benefit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
}
.benefit-row .benefit-name { flex: 1; font-size: 13px; }
.benefit-row .benefit-amount { font-weight: 600; font-size: 13px; color: var(--success); }
.benefit-row .benefit-actions { display: flex; gap: 4px; }
.tier-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.tier-row .form-input { padding: 5px 8px; font-size: 12px; }
.gradient-preview { font-size: 11px; color: var(--text-secondary); padding-top: 4px; max-height: 120px; overflow-y: auto; }
.salary-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    color: white;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.salary-summary-item { text-align: center; }
.salary-summary-item .label { font-size: 12px; opacity: 0.8; }
.salary-summary-item .value { font-size: 22px; font-weight: 700; margin-top: 4px; }

/* ========== 动画 ========== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.fade-in { animation: fadeIn 0.3s ease; }

/* ========== 炫酷首页 / 语音厅风格 ========== */
.dashboard-page { padding-bottom: 40px; }
.dashboard-hero {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 36px;
    color: white;
    overflow: hidden;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 35%, #DB2777 100%);
    box-shadow: 0 20px 40px rgba(79,70,229,0.25);
}
.dashboard-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18) 0%, transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(255,255,255,0.12) 0%, transparent 35%);
    pointer-events: none;
}
.hero-glow {
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 60%);
    top: -150px; right: -150px;
    animation: pulseGlow 6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes pulseGlow {
    0%,100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0.9; }
}
.hero-waves {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    height: 40px;
    opacity: 0.7;
}
.hero-waves span {
    width: 6px;
    background: rgba(255,255,255,0.7);
    border-radius: 3px;
    animation: wave 1.2s ease-in-out infinite;
}
.hero-waves span:nth-child(1) { height: 14px; animation-delay: 0s; }
.hero-waves span:nth-child(2) { height: 28px; animation-delay: 0.1s; }
.hero-waves span:nth-child(3) { height: 20px; animation-delay: 0.2s; }
.hero-waves span:nth-child(4) { height: 36px; animation-delay: 0.3s; }
.hero-waves span:nth-child(5) { height: 16px; animation-delay: 0.4s; }
@keyframes wave {
    0%,100% { transform: scaleY(1); opacity: 0.6; }
    50% { transform: scaleY(1.5); opacity: 1; }
}
.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 24px;
}
.hero-icon {
    font-size: 64px;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.hero-content h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.hero-content p { font-size: 15px; opacity: 0.9; }
.hero-badges {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px;
    font-size: 13px;
    backdrop-filter: blur(8px);
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.dashboard-stats .stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.dashboard-stats .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}
.dashboard-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.quick-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
}
.quick-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(79,70,229,0.12);
    transform: translateY(-2px);
}
.quick-icon {
    width: 48px; height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.quick-card strong { font-size: 15px; color: var(--text-primary); }
.quick-card p { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.dashboard-recent { margin-top: 0; }

/* ========== 个人资料页 ========== */
.profile-page { max-width: 900px; margin: 0 auto; }
.profile-hero {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    border-radius: var(--radius-lg);
    padding: 32px;
    color: white;
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.profile-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 90% 20%, rgba(255,255,255,0.12) 0%, transparent 40%);
}
.profile-avatar {
    position: relative;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--bg-white);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
    color: var(--primary);
    border: 4px solid rgba(255,255,255,0.3);
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
    transition: transform 0.2s;
}
.profile-avatar:hover { transform: scale(1.05); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar .avatar-tip {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 11px;
    padding: 4px 0;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.profile-avatar:hover .avatar-tip { opacity: 1; }
.profile-hero-info { z-index: 1; }
.profile-hero-info h2 { font-size: 24px; margin-bottom: 4px; }
.profile-hero-info p { opacity: 0.9; font-size: 14px; }
.profile-section {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}
.profile-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.profile-field-grid .form-group { margin: 0; }
.profile-field-grid .form-group label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.profile-field-grid .form-input:disabled { background: var(--surface-soft); color: var(--text-secondary); }
.profile-tags {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.profile-tag {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
}
.profile-custom-fields { margin-top: 16px; }
.custom-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.profile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ========== 权限设置 ========== */
.perm-role-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.perm-role-tab {
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    min-width: 140px;
    position: relative;
}
.perm-role-tab:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(99,102,241,0.1); }
.perm-role-tab.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 2px 12px rgba(99,102,241,0.15); }
.perm-role-tab.locked { background: var(--surface-soft); cursor: default; }
.perm-role-tab.locked:hover { border-color: var(--border); box-shadow: none; }
.perm-role-tab.locked.active { border-color: #94A3B8; background: var(--surface-soft-2); }
.perm-role-name { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.perm-role-desc { display: block; font-size: 12px; color: var(--text-secondary); }
.perm-lock-icon { position: absolute; right: 12px; top: 12px; font-size: 16px; opacity: 0.5; }
.perm-role-panel { display: none; }
.perm-role-panel.active { display: block; }
.perm-locked-msg {
    padding: 10px 16px;
    background: #F0FDF4;
    color: #166534;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #BBF7D0;
}
.perm-select-all {
    padding: 8px 0 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.perm-select-all label { font-weight: 600; font-size: 14px; cursor: pointer; user-select: none; }
.perm-select-all input { margin-right: 6px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.perm-group {
    background: var(--surface-soft);
    border-radius: 10px;
    padding: 14px;
}
.perm-group-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border);
}
.perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    transition: background 0.15s;
    border-radius: 4px;
    padding-left: 4px;
}
.perm-item:hover { background: rgba(99,102,241,0.05); }
.perm-item.disabled { opacity: 0.6; cursor: default; }
.perm-item.disabled:hover { background: none; }
.perm-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.perm-item.disabled input[type="checkbox"] { cursor: default; }
.perm-save-row { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.perm-save-status { font-size: 13px; }
.perm-save-status.success { color: #166534; }
.perm-save-status.error { color: #991B1B; }

/* ========== 留言板 ========== */
.messages-page .page-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 6px; }
.messages-layout { display: grid; gap: 20px; max-width: 900px; }
.message-composer { padding: 20px; }
.message-composer h3 { margin-bottom: 12px; font-size: 16px; }
.message-composer textarea { width: 100%; resize: vertical; min-height: 100px; }
.message-composer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.char-count { font-size: 12px; color: var(--text-secondary); }
.message-list { padding: 20px; min-height: 200px; }
.message-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); transition: opacity 0.2s; }
.message-item:last-child { border-bottom: none; }
.message-self { background: rgba(99, 102, 241, 0.04); margin: 0 -20px; padding: 16px 20px; }
.message-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; font-size: 14px; }
.message-body { flex: 1; min-width: 0; }
.message-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.message-author { font-weight: 600; color: var(--text-primary); }
.message-role { font-size: 12px; color: var(--text-secondary); background: var(--primary-light); padding: 2px 8px; border-radius: 12px; }
.message-time { font-size: 12px; color: var(--text-secondary); margin-left: auto; }
.message-tag { font-size: 11px; padding: 2px 8px; border-radius: 12px; font-weight: 500; }
.message-tag-self { background: rgba(79, 110, 247, 0.12); color: var(--primary); }
.message-tag-admin { background: rgba(34, 197, 94, 0.12); color: #16A34A; }
.message-content { color: var(--text-primary); line-height: 1.6; word-break: break-word; font-size: 14px; }
.message-actions { margin-top: 8px; }
.btn-text { background: none; border: none; color: var(--text-secondary); font-size: 12px; cursor: pointer; padding: 0; }
.btn-text:hover { color: var(--danger); text-decoration: underline; }
.load-more-wrap { text-align: center; margin-top: 12px; }

/* ========== 注册增强 ========== */
.success-msg {
    display: none;
    background: #DCFCE7;
    color: #166534;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
}
.password-strength { height: 4px; background: var(--border); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.pw-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; }
.pw-weak { background: #EF4444; }
.pw-fair { background: #F59E0B; }
.pw-good { background: #6366F1; }
.pw-strong { background: #22C55E; }
.password-strength-label { font-size: 12px; margin-top: 4px; color: var(--text-secondary); }
.password-strength-label.pw-weak { color: #EF4444; }
.password-strength-label.pw-fair { color: #F59E0B; }
.password-strength-label.pw-good { color: #6366F1; }
.password-strength-label.pw-strong { color: #16A34A; }
.register-hint {
    font-size: 12px; color: #F59E0B; background: #FFFBEB; padding: 8px 12px;
    border-radius: 6px; margin-bottom: 12px; text-align: center;
}
.form-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.switch-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.input-row { display: flex; gap: 8px; align-items: center; }
.reg-settings-form .form-group { margin-bottom: 24px; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .salary-summary { grid-template-columns: repeat(2, 1fr); }
}

/* 新人培养模块 */
.onb-list-item { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: var(--bg-white); transition: border-color .15s; }
.onb-list-item:hover { border-color: var(--primary); }

/* ========== 每周有效时长 ========== */
.dur-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dur-toolbar .btn { white-space: nowrap; flex-shrink: 0; }

.dur-pick { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.dur-pick .form-select { width: auto; min-width: 128px; height: 32px; padding: 0 8px; font-size: 13px; }
.dur-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); }
.dur-legend .lg { display: inline-block; width: 14px; height: 8px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.lg-prev { background: #CBD5E1; }
.lg-cur { background: var(--primary); }
.dur-head, .dur-row { display: grid; grid-template-columns: 150px minmax(110px, 1fr) 62px 62px 66px 70px; align-items: center; column-gap: 10px; }
.dur-head { padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); }
.dur-row { padding: 9px 4px; border-bottom: 1px solid var(--surface-soft-2); }
.dur-row:hover { background: #FAFBFD; }
.dur-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dur-bars { display: flex; flex-direction: column; gap: 3px; }
.dur-bar { height: 7px; background: var(--surface-soft-2); border-radius: 4px; overflow: hidden; }
.dur-bar i { display: block; height: 100%; border-radius: 4px; }
.dur-bar-prev i { background: #CBD5E1; }
.dur-bar-cur i { background: var(--primary); }
.dur-num { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.dur-prev { color: var(--text-secondary); }
.dur-cur { color: var(--text); font-weight: 600; }
.dur-days { font-size: 12px; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.dur-up { color: var(--success); }
.dur-down { color: var(--danger); }
.dur-flat { color: #94A3B8; }
.ta-r { text-align: right; }
.dur-foot { padding: 10px 4px 2px; font-size: 12px; color: #94A3B8; }
.dur-mline { display: none; }

/* ===== 页面数据更新时间条（每个展示页顶部） ===== */
.upd-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 8px 12px;
  background: var(--surface-soft); border: 1px solid #E7ECF3; border-radius: 10px;
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.5;
}
.upd-dot { width: 7px; height: 7px; border-radius: 50%; background: #22C55E; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.upd-bar.is-stale .upd-dot { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,.16); }
.upd-bar.is-empty .upd-dot { background: #CBD5E1; box-shadow: 0 0 0 3px rgba(148,163,184,.14); }
.upd-main { color: var(--text-secondary); }
.upd-main b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.upd-ago { margin-left: 6px; color: #94A3B8; font-size: 12px; }
.upd-sub { color: #64748B; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.upd-sub b { color: var(--text); font-weight: 600; }
.upd-sep { color: #CBD5E1; margin: 0 2px; }
.upd-bar.is-stale .upd-sub { color: #B45309; }
.upd-refresh { margin-left: auto; border: 1px solid var(--border); background: var(--bg-white); color: var(--primary); font-size: 12px; padding: 2px 10px; border-radius: 999px; cursor: pointer; flex-shrink: 0; }
.upd-refresh:hover { background: #EEF2FF; border-color: #C7D2FE; }

/* ===== 厅管规则：超管选择厅 ===== */
.hall-pick { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hall-pick label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.hall-pick .form-select { width: 150px; }

/* ========== 首充消费页（不计入厅管提成） ========== */
.fc-note {
    font-size: 13px; line-height: 1.75; color: var(--text-secondary);
    background: var(--surface-soft); border-left: 3px solid var(--primary);
    padding: 9px 12px; border-radius: 6px; margin: 0 0 12px;
}
.fc-note b { color: var(--text); }
.fc-note span { color: var(--warning); font-weight: 600; }
.fc-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.fc-cov { font-size: 12px; color: var(--text-secondary); }
.fc-red { color: var(--danger); }
.fc-blue { color: var(--primary-dark); }
.fc-muted { color: var(--text-secondary); font-size: 12px; }
tr.fc-row-on td { background: var(--primary-light); }
/* 行内小警示：分摊合计 ≠ 当天消费、已消费但没拆分等，就地在单元格里标出来 */
.fc-warn-inline { color: #B45309; font-size: 11.5px; line-height: 1.5; }
.fc-warn {
    margin: 10px 0 0; font-size: 12.5px; line-height: 1.7; color: #92400E;
    background: #FFFBEB; border-left: 3px solid var(--warning);
    padding: 8px 12px; border-radius: 6px;
}

/* ========== 首充档案存档页（仅超管） ========== */
.fca-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.fca-field {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12.5px; color: var(--text-secondary);
}
.fca-field .form-input { width: 168px; }
.fca-file { flex: 1; min-width: 220px; padding: 8px 10px; height: auto; }
.fca-tip { margin: 8px 0 0; font-size: 12px; color: var(--text-secondary); line-height: 1.7; }
.fca-tip b { color: var(--text); }
.fca-badge {
    display: inline-block; padding: 1px 8px; border-radius: 999px;
    font-size: 11.5px; background: var(--primary-light); color: var(--primary-dark);
}
.fca-day-pill {
    display: inline-block; margin: 3px 4px 0 0; padding: 1px 9px; border-radius: 999px;
    font-size: 12px; background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A;
    text-decoration: none; white-space: nowrap;
}
.fca-day-pill:hover { background: #FDE68A; }

/* 档案在线查看：HTML / 图片直接铺在文件列表下面，不用下载 */
.fca-view { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.fca-view-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.fca-view-title { font-size: 13px; color: var(--text); min-width: 0; word-break: break-all; }
.fca-view-title b { font-weight: 600; }
.fca-view-meta { font-size: 12px; color: var(--text-secondary); margin-left: 8px; font-weight: 400; }
.fca-view-acts { display: flex; gap: 8px; flex-shrink: 0; }
.fca-view-body {
    border: 1px solid var(--border); border-radius: 10px; overflow: auto;
    max-height: 78vh; background: #f3f5f8; -webkit-overflow-scrolling: touch;
}
.fca-view-img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.fca-view-text {
    margin: 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.75;
    white-space: pre-wrap; word-break: break-word; color: var(--text);
}
.fca-view-load { margin: 0; padding: 28px 16px; text-align: center; font-size: 13px; color: var(--text-secondary); }
@media (max-width: 600px) {
    .fca-view-body { max-height: 66vh; }
    .fca-view-meta { display: block; margin: 2px 0 0; }
}

@media (max-width: 600px) {
    .fca-form { flex-direction: column; align-items: stretch; }
    .fca-field .form-input, .fca-file { width: 100%; }
}

/* 流水看板 · 分厅看（超管/管理员） */
.flow-hall-switch {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.flow-hall-switch .flow-hall-label {
    font-size: 12px; color: var(--text-secondary); margin-right: 2px;
}
@media (max-width: 600px) {
    .flow-hall-switch { gap: 6px; }
    .flow-hall-switch .btn { padding: 5px 10px; font-size: 12px; }
}

.flow-hall-switch .flow-hall-note {
    font-size: 12px; color: #B45309; background: #FEF3C7;
    border: 1px solid #FDE68A; border-radius: 999px; padding: 1px 10px;
}

/* 厅管视角：本页只统计本厅 */
.flow-scope-note {
    margin: 10px 0 12px; font-size: 12px; color: var(--text-secondary);
    background: rgba(0,0,0,0.03); border-left: 3px solid var(--primary);
    border-radius: 4px; padding: 6px 10px;
}

/* 人员明细分页条（主持多了以后只渲染当前页） */
.flow-pager {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; flex-wrap: wrap; padding: 10px 16px 14px;
    font-size: 12px; color: var(--text-secondary);
}

/* 首充消费 · 各厅厅管提成拆分 */
.fc-hall-tag {
    display: inline-block; margin: 0 4px; padding: 0 6px;
    font-size: 11px; line-height: 16px; border-radius: 4px;
    color: var(--text-secondary); background: rgba(0,0,0,0.05);
}
.fc-hall-detail { background: #FAFAFA; padding: 10px 14px !important; }
.fc-hall-head { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.fc-hall-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-hall-chip {
    display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--bg-white); font-size: 12px; line-height: 1.6;
}
.fc-hall-chip b { font-weight: 600; }
@media (max-width: 600px) {
    .fc-hall-chip { width: 100%; border-radius: 8px; }
}

.data-table td.fc-hall-name { white-space: nowrap; }

/* ========== KPI 指标卡（方案 A：大数字 + 左侧色条） ========== */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.kpi {
    position: relative; overflow: hidden;
    background: var(--bg-white); border: 1px solid var(--card-line);
    border-radius: var(--radius-lg); padding: 15px 18px 14px;
}
.kpi::after {
    content: ''; position: absolute; left: 0; top: 14px; bottom: 14px;
    width: 2px; border-radius: 0 2px 2px 0; background: var(--primary); opacity: .5;
}
.kpi .kpi-lb { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.kpi .kpi-val {
    font-family: var(--num-font); font-size: 24px; font-weight: 700; letter-spacing: -.5px;
    color: var(--text); margin-top: 4px; line-height: 1.2; font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.kpi .kpi-val em { font-style: normal; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); margin-left: 3px; letter-spacing: 0; }
.kpi .kpi-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.kpi.is-strong::after { background: var(--primary); opacity: .9; }
.kpi.is-warn::after { background: var(--warning); opacity: .95; }
.kpi.is-warn .kpi-sub { color: var(--warning); font-weight: 600; }
.kpi.is-ok::after { background: var(--success); opacity: .85; }
.kpi.is-ok .kpi-sub { color: var(--success); }

/* 数字统一等宽，列才对得齐 */
.num, .tnum { font-family: var(--num-font); font-variant-numeric: tabular-nums; letter-spacing: -.2px; }

/* ========== 视图开关（夜间 / 紧凑） ========== */
.view-toggles {
    display: flex; gap: 6px; padding: 0 2px 8px;
}
.vt-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 4px; font-size: 12px; font-family: inherit;
    color: var(--side-text); background: transparent;
    border: 1px solid var(--side-line); border-radius: var(--radius);
    cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.vt-btn:hover { background: var(--side-active-bg); color: var(--side-active-text); }
.vt-btn.on {
    background: rgba(255,255,255,.14); color: #FFFFFF; border-color: rgba(255,255,255,.22);
    font-weight: 600;
}
.vt-btn .vi { font-size: 13px; line-height: 1; }
