* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { background: #f3f6f9; padding: 24px 20px; color: #1e293b; }
.app-container { max-width: 1600px; margin: 0 auto; }
.header { display: flex; align-items: center; justify-content: space-between; background: white; padding: 12px 24px; border-radius: 20px; box-shadow: 0 4px 8px rgba(0,0,0,0.02); margin-bottom: 20px; border: 1px solid #e9eef2; }
.logo h1 { font-size: 1.6rem; font-weight: 600; color: #0f3b5e; }
.user-area { display: flex; align-items: center; gap: 20px; }
.role-badge { background: #e6f0fa; padding: 6px 16px; border-radius: 30px; font-weight: 500; color: #1e4b6e; }
.logout-btn { background: #f1f5f9; border: 1px solid #cbd5e1; padding: 6px 16px; border-radius: 30px; cursor: pointer; font-weight: 500; }
.nav-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.nav-btn { padding: 10px 24px; border: none; background: white; border-radius: 30px; font-weight: 500; cursor: pointer; border: 1px solid #e2e8f0; }
.nav-btn.active { background: #1e4b6e; color: white; border-color: #1e4b6e; }
.view-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn { padding: 8px 20px; border: none; background: white; border-radius: 30px; font-weight: 500; cursor: pointer; border: 1px solid #e2e8f0; font-size: 0.9rem; }
.tab-btn.active { background: #1e4b6e; color: white; border-color: #1e4b6e; }
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search-bar input, .search-bar select { padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 30px; font-size: 0.9rem; background: white; }
.date-range { display: flex; gap: 4px; align-items: center; }
.stats-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card { background: white; padding: 16px 20px; border-radius: 20px; border: 2px solid transparent; flex: 1 1 150px; cursor: pointer; transition: all 0.2s; }
.stat-card:hover { border-color: #1e4b6e; }
.stat-card.active { border-color: #1e4b6e; background: #f0f7ff; }
.stat-label { font-size: 0.8rem; color: #64748b; }
.stat-number { font-size: 2rem; font-weight: 700; color: #0b2b44; }
.warning-highlight { color: #b45330; }
.success-highlight { color: #10b981; }
.filter-tags { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-label { font-weight: 500; color: #64748b; font-size: 0.85rem; }
.tag-btn { padding: 5px 14px; background: white; border: 1px solid #e2e8f0; border-radius: 30px; cursor: pointer; font-size: 0.8rem; }
.tag-btn.active { background: #1e4b6e; color: white; border-color: #1e4b6e; }
.card { background: white; border-radius: 24px; padding: 24px 28px; margin-bottom: 30px; border: 1px solid #eef2f6; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.card-header h2 { font-weight: 600; font-size: 1.5rem; color: #1e3a5f; }
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 16px; align-items: end; }
@media (max-width: 1400px) { .form-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1000px) { .form-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 500; font-size: 0.8rem; color: #334155; }
.form-group input, .form-group select { padding: 10px 12px; border: 1.5px solid #e2e8f0; border-radius: 16px; font-size: 0.9rem; background: #fafcff; }
.btn { background: #1e4b6e; color: white; border: none; padding: 10px 20px; border-radius: 40px; font-weight: 600; cursor: pointer; }
.btn-secondary { background: white; color: #1e4b6e; border: 1.5px solid #cbd5e1; padding: 10px 20px; border-radius: 40px; font-weight: 600; cursor: pointer; }
.table-wrapper { overflow-x: auto; border-radius: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { text-align: left; padding: 12px 6px; background: #f8fafc; color: #1e3a5f; font-weight: 600; border-bottom: 2px solid #dde7f0; white-space: nowrap; }
td { padding: 10px 6px; border-bottom: 1px solid #ecf1f7; vertical-align: middle; }
.empty-row { text-align: center; padding: 36px; color: #64748b; }
.warning-tag { background: #fee2e2; color: #b91c1c; padding: 4px 8px; border-radius: 30px; font-size: 0.7rem; }
.next-followup { background: #e6f7e6; color: #1e7a5e; padding: 4px 8px; border-radius: 30px; font-size: 0.7rem; }
.intention-high { background: #dc2626; color: white; padding: 2px 6px; border-radius: 20px; }
.intention-mid { background: #f59e0b; color: white; padding: 2px 6px; border-radius: 20px; }
.intention-low { background: #10b981; color: white; padding: 2px 6px; border-radius: 20px; }
.visit-yes { background: #10b981; color: white; padding: 2px 6px; border-radius: 20px; }
.visit-no { background: #94a3b8; color: white; padding: 2px 6px; border-radius: 20px; }
.action-cell { display: flex; gap: 3px; flex-wrap: wrap; }
.icon-btn { background: none; border: 1px solid #cbd5e1; padding: 3px 6px; border-radius: 30px; cursor: pointer; font-size: 0.65rem; }
.login-container { background: white; border-radius: 32px; padding: 48px 40px; max-width: 420px; margin: 100px auto; box-shadow: 0 20px 40px rgba(0,0,0,0.1); }
.login-header { text-align: center; margin-bottom: 36px; }
.login-form .form-group { margin-bottom: 20px; }
.login-btn { width: 100%; padding: 16px; }
.demo-hint { margin-top: 24px; padding: 16px; background: #f1f5f9; border-radius: 16px; font-size: 0.85rem; }
.error-msg { color: #dc2626; text-align: center; margin-top: 12px; }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: white; border-radius: 24px; width: 90%; max-width: 750px; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.modal-body { padding: 20px 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.modal-body .full-width { grid-column: span 2; }
.modal-footer { padding: 20px 24px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 12px; }
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; }
.rank-1 { background: #fef3c7; }
.rank-2 { background: #e2e8f0; }
.rank-3 { background: #fed7aa; }
.appointment-no { font-weight: 600; color: #1e4b6e; font-size: 0.75rem; }
.track-cell { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 20px; }
.pagination button { padding: 6px 14px; border: 1px solid #cbd5e1; background: white; border-radius: 20px; cursor: pointer; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination span { color: #64748b; font-size: 0.9rem; }

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    body { padding: 12px 8px; }
    
    /* 头部 */
    .header { flex-direction: column; gap: 12px; padding: 16px; }
    .logo h1 { font-size: 1.3rem; text-align: center; }
    .user-area { width: 100%; justify-content: space-between; }
    
    /* 导航选项卡 - 横向滚动 */
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
    .nav-btn { padding: 8px 16px; font-size: 0.9rem; white-space: nowrap; flex-shrink: 0; }
    
    /* 视图选项卡 */
    .view-tabs { flex-wrap: wrap; }
    .tab-btn { padding: 6px 14px; font-size: 0.8rem; flex: 0 0 auto; }
    
    /* 搜索栏 - 垂直排列 */
    .search-bar { flex-direction: column; align-items: stretch; }
    .search-bar input { width: 100% !important; }
    .search-bar select { width: 100% !important; }
    .date-range { flex-wrap: wrap; }
    .date-range input { flex: 1; min-width: 130px; }
    
    /* 统计卡片 - 两列布局 */
    .stats-row { gap: 8px; }
    .stat-card { flex: 1 1 calc(50% - 8px); min-width: 140px; padding: 12px 14px; }
    .stat-number { font-size: 1.8rem; }
    
    /* 筛选标签 - 横向滚动 */
    .filter-tags { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
    .filter-label { flex-shrink: 0; }
    .tag-btn { padding: 4px 12px; font-size: 0.75rem; white-space: nowrap; flex-shrink: 0; }
    
    /* 卡片 */
    .card { padding: 16px; border-radius: 16px; margin-bottom: 16px; }
    .card-header { flex-wrap: wrap; gap: 10px; }
    .card-header h2 { font-size: 1.2rem; }
    
    /* 表单 - 单列布局 */
    .form-grid { grid-template-columns: 1fr !important; gap: 12px; }
    .form-group input, .form-group select { padding: 12px 14px; font-size: 16px; } /* 防止iOS缩放 */
    
    /* 表格 - 允许横向滚动 */
    .table-wrapper { margin: 0 -16px; width: calc(100% + 32px); border-radius: 0; }
    table { font-size: 0.75rem; }
    th, td { padding: 10px 4px; }
    
    /* 操作按钮 - 换行 */
    .action-cell { gap: 2px; }
    .icon-btn { padding: 5px 8px; font-size: 0.7rem; }
    
    /* 分页 */
    .pagination { flex-wrap: wrap; }
    .pagination button { padding: 8px 12px; font-size: 0.8rem; }
    .pagination span { width: 100%; text-align: center; order: -1; margin-bottom: 8px; }
    
    /* 弹窗 */
    .modal-content { width: 95%; max-height: 90vh; }
    .modal-body { grid-template-columns: 1fr !important; }
    .modal-body .full-width { grid-column: span 1; }
    .modal-header, .modal-footer { padding: 16px; }
    
    /* 登录页 */
    .login-container { padding: 32px 24px; margin: 20px auto; }
    
    /* 账号管理表单 */
    #accountsPage [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    
    /* 隐藏部分非核心列（可选，根据实际需要） */
    /* 如果想在手机上隐藏某些列，可以在这里添加 */
    /* 例如隐藏访问轨迹列： .track-cell { display: none; } */
}

/* 超小屏幕（<480px）进一步优化 */
@media (max-width: 480px) {
    .stats-row .stat-card { flex: 1 1 100%; }
    .stat-number { font-size: 2rem; }
    
    /* 表格进一步精简 */
    table { font-size: 0.7rem; }
    
    /* 操作按钮组 */
    .action-cell { justify-content: flex-start; }
}