/* ========== 变量 ========== */
:root {
  --primary: #007AFF;
  --success: #34C759;
  --warning: #FF9500;
  --danger: #FF3B30;
  --bg: #F2F2F7;
  --card-bg: #FFFFFF;
  --text: #1C1C1E;
  --text2: #8E8E93;
  --border: #E5E5EA;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ========== 重置 ========== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; padding-bottom: 80px; }

/* ========== 顶部 ========== */
.header { background: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-title { font-size: 18px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; }

/* ========== 统计栏 ========== */
.stats-bar { background: #fff; margin: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; justify-content: center; }
.stat-item { text-align: center; }
.stat-num { font-size: 40px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text2); margin-top: 4px; }

/* ========== 主内容 ========== */
.main { padding: 0 16px 16px; }

/* ========== 任务卡片 ========== */
.task-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; cursor: pointer; transition: transform 0.1s; }
.task-card:active { transform: scale(0.98); }
.task-card-header { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task-name { font-size: 16px; font-weight: 600; flex: 1; }
.task-delete { background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 8px; color: var(--text2); }
.task-meta { padding: 10px 16px; display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text2); }
.task-progress-wrap { padding: 0 16px 12px; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.progress-text { font-size: 12px; color: var(--text2); margin-top: 6px; display: flex; justify-content: space-between; }

/* 当前拨打显示 */
.current-call { background: #E8F4FF; border-top: 1px solid #C8E0FF; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.current-call-icon { font-size: 22px; }
.current-call-info { flex: 1; min-width: 0; }
.current-call-name { font-size: 15px; font-weight: 600; color: var(--text); }
.current-call-phone-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.current-call-phone { font-size: 13px; color: var(--text2); }
.btn-copy { background: #fff; border: 1px solid var(--primary); color: var(--primary); padding: 3px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: all 0.15s; }
.btn-copy:active { background: var(--primary); color: #fff; }

/* 拨打按钮 */
.dial-btn-area { padding: 8px 16px 18px; }
.btn-dial { width: 100%; height: 52px; background: var(--success); color: #fff; border: none; border-radius: 12px; font-size: 17px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: opacity 0.15s; }
.btn-dial:active { opacity: 0.8; }
.btn-dial:disabled { background: var(--border); color: var(--text2); cursor: not-allowed; }
.btn-dial-done { background: var(--text2); }

/* ========== 底部 ========== */
.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-text { font-size: 15px; margin-bottom: 6px; }
.empty-sub { font-size: 13px; }

/* ========== 按钮 ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: opacity 0.15s; white-space: nowrap; }
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #F2F2F7; color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: #FF9500; color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); border-radius: 10px; font-size: 14px; padding: 8px 16px; cursor: pointer; }
.btn-large { height: 48px; font-size: 16px; border-radius: 12px; }

/* ========== 弹窗 ========== */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; align-items: flex-end; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column; animation: slideUp 0.25s ease; }
.modal-large { max-height: 85vh; }
.modal-small .modal-content { border-radius: 20px; margin: auto 16px; max-height: 320px; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text2); cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-body { padding: 16px 20px; flex: 1; overflow-y: auto; }
.modal-footer { padding: 12px 20px 20px; display: flex; gap: 10px; flex-shrink: 0; }
.modal-footer .btn { flex: 1; height: 48px; font-size: 16px; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-group input[type=text], .form-group textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; outline: none; transition: border-color 0.2s; }
.form-group input[type=text]:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; font-family: 'Courier New', monospace; }
.required { color: var(--danger); }

/* 文件选择 */
.file-input-wrap { display: flex; gap: 8px; }

/* ========== 详情弹窗 ========== */
.detail-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.detail-tab { flex: 1; padding: 12px 8px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 14px; font-weight: 500; color: var(--text2); cursor: pointer; text-align: center; transition: all 0.15s; }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.detail-tab span { background: var(--bg); padding: 2px 7px; border-radius: 10px; font-size: 12px; margin-left: 4px; }

.detail-list { flex: 1; overflow-y: auto; padding: 8px 16px; }
.detail-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.detail-item:last-child { border-bottom: none; }
.detail-item-info { flex: 1; min-width: 0; }
.detail-item-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-item-phone { font-size: 13px; color: var(--text2); margin-top: 2px; }
.detail-item-status { font-size: 12px; padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.status-pending { background: #FFF3E0; color: #E67E00; }
.status-connected { background: #E8F5E9; color: #2E7D32; }
.status-missed { background: #FFEBEE; color: #C62828; }

.detail-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-shrink: 0; }

/* ========== 拨打结果（卡片内联） ========== */
.result-btns-inline { display: flex; gap: 10px; }
.result-btns-inline .btn { flex: 1; height: 48px; font-size: 15px; }

/* ========== Toast ========== */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px); background: rgba(0,0,0,0.75); color: #fff; padding: 10px 20px; border-radius: 24px; font-size: 14px; white-space: nowrap; opacity: 0; transition: all 0.25s; pointer-events: none; z-index: 999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ========== 预览 ========== */
.preview-area { background: var(--bg); border-radius: 10px; padding: 12px; margin-top: 8px; }
.preview-label { font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.preview-list { font-size: 12px; color: var(--text); max-height: 80px; overflow-y: auto; line-height: 1.8; font-family: monospace; }
.file-name { font-size: 13px; color: var(--primary); margin-top: 6px; }

/* ========== 响应式 ========== */
@media (min-width: 640px) {
  .modal { align-items: center; }
  .modal-content { border-radius: 20px; }
}
