* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --primary-bg: #eef2ff;
    --success: #059669;
    --success-light: #10b981;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-light: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-light: #ef4444;
    --danger-bg: #fef2f2;
    --purple: #7c3aed;
    --purple-bg: #f5f3ff;
    --teal: #0d9488;
    --teal-bg: #f0fdfa;
    --blue: #2563eb;
    --blue-bg: #eff6ff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 10px;
    --radius-lg: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* SVG Icons */
.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* Login Page */
.login-container {
    /* v1.6.2 安全修复：固定全屏遮罩，未登录时盖满整个视口，
       杜绝"登录页往下滑看到系统内容"的问题 */
    position: fixed;
    inset: 0;
    z-index: 1000;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    top: -200px;
    right: -100px;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    bottom: -150px;
    left: -100px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(79,70,229,0.3);
}

.login-logo .icon {
    width: 36px;
    height: 36px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.login-header p {
    font-size: 13px;
    color: var(--gray-400);
    font-weight: 400;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-100);
}

.login-footer p {
    font-size: 12px;
    color: var(--gray-400);
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--purple) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.sidebar-logo .icon {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.35);
    padding: 12px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.15s;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-item.active {
    background: rgba(99,102,241,0.25);
    color: white;
    box-shadow: inset 3px 0 0 var(--primary-light);
}

.nav-item .icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.nav-item.active .icon { opacity: 1; }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 12px 8px;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-light), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.user-detail {
    display: flex;
    flex-direction: column;
}

#currentUserName {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.role-badge {
    font-size: 10px;
    background: rgba(255,255,255,0.1);
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 2px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
}

.role-badge.admin {
    background: rgba(16,185,129,0.2);
    color: #6ee7b7;
}

.logout-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    transition: all 0.15s;
}

.logout-btn:hover {
    background: rgba(239,68,68,0.2);
    color: #fca5a5;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.3px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-status {
    font-size: 12px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.page-content {
    padding: 24px 28px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* 工作台 7 卡片固定 4+3 两行布局 */
.stats-grid.cols4 {
    grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
    .stats-grid.cols4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon .icon { width: 26px; height: 26px; }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icon.teal { background: var(--teal-bg); color: var(--teal); }

.stat-info { min-width: 0; }

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 2px;
    font-weight: 500;
}

/* Dashboard Row */
.dashboard-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
}

@media (max-width: 1200px) {
    .dashboard-row { grid-template-columns: 1fr; }
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-header .icon {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.card-body {
    padding: 0;
}

/* Page Actions */
.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 600px;
}

.search-bar input,
.search-bar select {
    padding: 9px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    background: white;
    color: var(--gray-700);
    transition: all 0.15s;
}

.search-bar input:focus,
.search-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.search-bar input {
    flex: 1;
    min-width: 150px;
}

.action-btns-row {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    padding: 9px 16px;
    border-radius: var(--radius);
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    white-space: nowrap;
}

.btn .icon { width: 16px; height: 16px; }

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(79,70,229,0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 4px rgba(79,70,229,0.4);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover { background: #047857; }

.btn-danger {
    background: white;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: var(--danger-bg);
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-500);
    padding: 6px 10px;
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-sm .icon { width: 14px; height: 14px; }

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    font-family: inherit;
    background: white;
    color: var(--gray-800);
    transition: all 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.data-table th {
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-400);
    background: var(--gray-50);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 13px;
    color: var(--gray-700);
}

.data-table tbody tr:hover td {
    background: #fafbfc;
}

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

.table-actions {
    display: flex;
    gap: 4px;
}

.table-actions .btn {
    padding: 4px 8px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-valid { background: var(--success-bg); color: var(--success); }
.status-urgent { background: var(--danger-bg); color: var(--danger); }
.status-warning { background: var(--warning-bg); color: var(--warning); }
.status-notice { background: var(--blue-bg); color: var(--blue); }
.status-expired { background: #fecaca; color: #991b1b; }
.status-open { background: var(--blue-bg); color: var(--blue); }
.status-matched { background: var(--success-bg); color: var(--success); }
.status-closed { background: var(--gray-100); color: var(--gray-500); }
.status-pending { background: var(--warning-bg); color: var(--warning); }
.status-in_progress { background: var(--blue-bg); color: var(--blue); }
.status-completed { background: var(--success-bg); color: var(--success); }
.status-active { background: var(--success-bg); color: var(--success); }
.status-disabled { background: var(--gray-100); color: var(--gray-500); }
/* 录入明细的类型标签（客户/人员/证书） */
.status-blue { background: var(--blue-bg); color: var(--blue); }
.status-green { background: var(--success-bg); color: var(--success); }
.status-purple { background: var(--purple-bg); color: var(--purple); }

/* 页内小标签（如「统计日期」） */
.field-inline-label {
    font-size: 13px;
    color: var(--gray-600);
    white-space: nowrap;
}

/* ICP 备案号页脚（工信部要求展示） */
.icp-footer {
    text-align: center;
    padding: 12px 0 16px;
    font-size: 12px;
    color: var(--gray-400);
}
.icp-footer a {
    color: var(--gray-400);
    text-decoration: none;
}
.icp-footer a:hover {
    color: var(--gray-600);
    text-decoration: underline;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-100);
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-600);
    transition: all 0.15s;
    min-width: 32px;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-bg);
    border-color: var(--primary-light);
    color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .pager-size {
    margin-left: 10px;
    padding: 5px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    color: var(--gray-600);
    background: white;
    cursor: pointer;
}

/* Activity List */
.activity-list {
    padding: 8px 20px;
    max-height: 320px;
    overflow-y: auto;
}

.activity-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-50);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-content { flex: 1; }

.activity-text {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.4;
}

.activity-user {
    font-weight: 600;
    color: var(--primary);
}

.activity-time {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 3px;
}

/* Fee Summary */
.fee-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.fee-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 22px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
}

.fee-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.fee-card.income::after { background: linear-gradient(90deg, var(--success), var(--success-light)); }
.fee-card.expense::after { background: linear-gradient(90deg, var(--danger), var(--danger-light)); }
.fee-card.net::after { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }

.fee-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 8px;
    font-weight: 500;
}

.fee-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.fee-card.income .fee-value { color: var(--success); }
.fee-card.expense .fee-value { color: var(--danger); }
.fee-card.net .fee-value { color: var(--primary); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17,24,39,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 620px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    animation: slideUp 0.2s ease;
}

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

.modal.wide { max-width: 900px; }

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 2000;
    pointer-events: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Settings */
.settings-section {
    margin-bottom: 0;
    padding: 24px;
    border-bottom: 1px solid var(--gray-100);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-800);
}

.settings-section > p {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.sync-status-bar {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sync-status-bar.ok {
    background: var(--success-bg);
    color: var(--success);
}

.sync-status-bar.warn {
    background: var(--warning-bg);
    color: var(--warning);
}

.sync-status-bar.info {
    background: var(--gray-50);
    color: var(--gray-500);
}

.backup-list { margin-top: 12px; }

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 13px;
}

.cert-types-list { margin-top: 12px; }

.cert-type-item {
    padding: 14px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.cert-type-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-800);
}

.cert-specialties {
    font-size: 12px;
    color: var(--gray-500);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Admin-only visibility */
.admin-only {
    display: none !important;
}
body.is-admin .admin-only:not(.page) {
    display: flex !important;
}
body.is-admin .page.admin-only.active {
    display: block !important;
}

/* Detail View */
.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--gray-700);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-item {
    display: flex;
    gap: 8px;
    padding: 8px 0;
}

.detail-label {
    font-size: 13px;
    color: var(--gray-500);
    min-width: 80px;
    font-weight: 500;
}

.detail-value {
    font-size: 13px;
    color: var(--gray-800);
}

/* Batch Certificate Table */
.batch-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.batch-table th,
.batch-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

.batch-table th {
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-50);
    white-space: nowrap;
    text-align: left;
}

.batch-table select,
.batch-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.batch-table select:focus,
.batch-table input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.1);
}

.batch-row-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.batch-row-remove:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.add-batch-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius);
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.add-batch-row:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

/* Utility classes */
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--gray-400); font-size: 12px; }
.text-primary { color: var(--primary); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.empty-state .icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

/* Tab styles for batch vs single */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-100);
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-btn:hover:not(.active) {
    color: var(--gray-700);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Remember Password Checkbox */
.remember-me {
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-600);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* Password Strength Meter */
.password-strength {
    margin-top: 6px;
}

.strength-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.strength-segment {
    height: 4px;
    flex: 1;
    background: var(--gray-200);
    border-radius: 2px;
    transition: all 0.2s;
}

.strength-segment.weak { background: var(--danger); }
.strength-segment.medium { background: var(--warning); }
.strength-segment.strong { background: var(--success); }

.strength-text {
    font-size: 12px;
    font-weight: 500;
}

.strength-text.weak { color: var(--danger); }
.strength-text.medium { color: var(--warning); }
.strength-text.strong { color: var(--success); }

/* Nav Badge */
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Excel Import */
.import-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: all 0.15s;
    background: var(--gray-50);
}

.import-textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.import-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 6px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 12px;
    max-height: 300px;
    overflow: auto;
    display: block;
}

.preview-table th,
.preview-table td {
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    white-space: nowrap;
}

.preview-table th {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.preview-table tr:nth-child(even) td {
    background: var(--gray-50);
}

.column-mapping {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.column-mapping select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
}

/* Status Badge Colors for Demands */
.status-processing { background: var(--purple-bg); color: var(--purple); }

/* User Assignment Info */
.assignee-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-500);
}

.creator-info {
    font-size: 11px;
    color: var(--gray-400);
}

/* Demand Notes Textarea */
.deal-notes {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}

/* Demand History Timeline */
.timeline {
    padding: 8px 0;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-left: 2px solid var(--gray-200);
    padding-left: 16px;
    position: relative;
    margin-left: 8px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item.status-open::before { background: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.timeline-item.status-processing::before { background: var(--purple); box-shadow: 0 0 0 2px var(--purple); }
.timeline-item.status-closed::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }

.timeline-content {
    flex: 1;
}

.timeline-action {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-800);
}

.timeline-user {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.timeline-time {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

.timeline-notes {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 4px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 6px;
}

/* Enterprise Dashboard */
.enterprise-dashboard {
    margin-bottom: 20px;
}

/* Transfer User Modal */
.transfer-warning {
    background: var(--warning-bg);
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.transfer-warning .icon {
    color: var(--warning);
    flex-shrink: 0;
}

.transfer-warning p {
    font-size: 13px;
    color: var(--warning);
    line-height: 1.5;
}

/* Login History Status */
.login-success { color: var(--success); }
.login-fail { color: var(--danger); }

/* Contact Encrypted */
.contact-encrypted {
    color: var(--gray-400);
    font-style: italic;
    font-size: 12px;
}

.contact-visible {
    color: var(--gray-700);
}

/* Empty state improvement */
.empty-state-help {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 8px;
}

.empty-state-help a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

/* Role Select */
.role-admin { color: var(--purple); font-weight: 600; }
.role-employee { color: var(--gray-600); }

/* Quick actions in modal */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-btn {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    background: white;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s;
}

.quick-action-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* ==================== Analytics Page ==================== */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

#page-analytics .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 0;
}
#page-analytics .card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}
#page-analytics .card-header .muted {
    font-size: 12px;
}
#page-analytics .card-body {
    padding: 20px;
}
.loading, .empty-state-text {
    text-align: center;
    padding: 30px 0;
    color: var(--gray-400);
    font-size: 13px;
}

/* Horizontal bar chart (user rank) */
.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.bar-label {
    width: 110px;
    font-size: 13px;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.bar-track {
    flex: 1;
    height: 22px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.bar-count {
    width: 50px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    flex-shrink: 0;
}

/* Pie distribution bar */
.pie-bar {
    display: flex;
    width: 100%;
    height: 26px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}
.pie-slice {
    height: 100%;
    transition: width 0.3s;
}
.pie-total {
    font-size: 13px;
    margin-bottom: 12px;
    color: var(--gray-600);
}
.pie-total b {
    color: var(--primary-dark);
    font-size: 16px;
    margin: 0 4px;
}
.legend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-700);
}
.legend-item b {
    color: var(--gray-900);
    font-weight: 600;
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Ring chart (demand stats) */
.ring-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
}
.ring-chart {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}
.ring-num {
    font-size: 20px;
    font-weight: 700;
    fill: var(--primary-dark);
}
.ring-sub {
    font-size: 10px;
    fill: var(--gray-500);
}
.ring-detail {
    flex: 1;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px dashed var(--gray-100);
    font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row b {
    color: var(--gray-900);
    font-weight: 600;
}

/* Vertical columns (fee trend) */
.col-grid {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 170px;
    padding: 15px 0 5px;
    gap: 4px;
}
.col-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.col-stack {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 145px;
}
.col-bar {
    width: 14px;
    border-radius: 3px 3px 0 0;
    transition: height 0.5s;
}
.col-income { background: linear-gradient(180deg,#10b981,#059669); }
.col-expense { background: linear-gradient(180deg,#ef4444,#dc2626); }
.col-net {
    font-size: 11px;
    font-weight: 600;
    height: 16px;
}
.col-net.net-pos { color: var(--success); }
.col-net.net-neg { color: var(--danger); }
.col-label {
    font-size: 11px;
    color: var(--gray-500);
}
.col-legend {
    display: flex;
    justify-content: center;
    gap: 22px;
    padding-top: 8px;
    font-size: 12px;
    color: var(--gray-600);
    border-top: 1px solid var(--gray-100);
    margin-top: 10px;
    padding-top: 12px;
}
.lg-sample {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: middle;
}

@media (max-width: 960px) {
    .analytics-grid { grid-template-columns: 1fr; }
    .legend-grid { grid-template-columns: 1fr; }
}

/* ==================== 客户管理 ==================== */
.form-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin: 2px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-100);
}
.form-section-title:not(:first-child) { margin-top: 20px; }

/* 手机号查重提示 */
.field-msg {
    font-size: 12px;
    line-height: 1.4;
    margin-top: 4px;
    min-height: 14px;
    color: var(--gray-400);
}
.field-msg.error { color: var(--danger); }
.field-msg.ok { color: var(--success); }
#c_phone.dup { border-color: var(--danger); }

/* 客户状态 7 档配色 */
.status-quote { background: #fff7ed; color: #ea580c; }
.status-pause { background: var(--purple-bg); color: var(--purple); }
.status-invalid { background: var(--danger-bg); color: var(--danger); }

/* 客户列表 */
.customer-name {
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
}
.customer-name:hover { text-decoration: underline; }

.tel-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--gray-700);
    text-decoration: none;
    white-space: nowrap;
}
.tel-link .icon { color: var(--success); width: 14px; height: 14px; }
.tel-link:hover { color: var(--primary); }
.tel-link:hover .icon { color: var(--primary); }

.pagination .page-info {
    font-size: 13px;
    color: var(--gray-500);
    margin-right: 10px;
}


/* ==================== 到期提醒（客户资质/安许/人员证书） ==================== */
.due-cell { display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
.due-line { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.due-tag {
    display: inline-block; padding: 1px 6px; border-radius: 4px;
    background: var(--gray-100, #eef0f4); color: var(--gray-600, #5b6472);
    font-size: 11px; line-height: 16px;
}
.reminder-tip {
    display: flex; align-items: flex-start; gap: 10px;
    background: #eef4ff; border: 1px solid #d3e1ff; color: #2f4b8f;
    border-radius: 10px; padding: 12px 16px; font-size: 13px; line-height: 1.7;
    margin-bottom: 16px;
}
.reminder-tip .icon { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; color: #3b6fe0; }
.reminder-summary { display: flex; gap: 14px; flex-wrap: wrap; }
.reminder-chip {
    flex: 1; min-width: 180px; border-radius: 12px; padding: 18px 20px;
    display: flex; align-items: center; gap: 14px; color: #fff;
}
.reminder-chip .chip-num { font-size: 28px; font-weight: 700; line-height: 1; }
.reminder-chip .chip-label { font-size: 13px; opacity: .92; }
.chip-qual { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.chip-safety { background: linear-gradient(135deg, #d97706, #f59e0b); }
.chip-cert { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.reminder-count {
    margin-left: auto; min-width: 24px; height: 24px; padding: 0 8px;
    border-radius: 12px; background: #fee2e2; color: #dc2626;
    font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
