:root {
  --primary: #1989fa;
  --primary-dark: #0f6fd6;
  --success: #07c160;
  --danger: #ee0a24;
  --warning: #ff976a;
  --bg: #f7f8fa;
  --card-bg: #ffffff;
  --text: #323233;
  --text-secondary: #646566;
  --text-light: #969799;
  --border: #ebedf0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 750px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 60px;
}

.login-page {
  max-width: 400px;
  margin: 80px auto;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 32px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.login-card h1 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text);
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-card .form-group {
  margin-bottom: 16px;
}

.login-card input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.login-card input:focus {
  border-color: var(--primary);
}

.login-card .btn-login {
  width: 100%;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.login-card .btn-login:hover {
  background: var(--primary-dark);
}

.login-card .btn-wecom {
  background: #07c160;
}
.login-card .btn-wecom:hover {
  background: #06ad56;
}

.login-card .quick-login {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.login-card .quick-login-title {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 10px;
}

.login-card .quick-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.login-card .quick-btn {
  padding: 6px 14px;
  background: #f2f3f5;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.login-card .quick-btn:hover {
  background: #e8eaec;
}

.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: 100;
}

.header .title {
  font-size: 17px;
  font-weight: 600;
}

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

.header .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
}

.header .role-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e8f3ff;
  color: var(--primary);
}

.header .role-tag.admin {
  background: #fff3e0;
  color: #e65100;
}

.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 57px;
  z-index: 99;
}

.tabs .tab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tabs .tab.active {
  color: var(--primary);
  font-weight: 500;
}

.tabs .tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.tab-content {
  display: none;
}

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.stat-card .value .unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 2px;
}

.stat-card.highlight .value {
  color: var(--primary);
}

.stat-card.success .value {
  color: var(--success);
}

.stat-card.warning .value {
  color: var(--warning);
}

.section-title {
  padding: 16px 16px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title .more {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
  cursor: pointer;
}

.card-list {
  padding: 0 12px;
}

.card-item {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
}

.card-item .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-item .card-title {
  font-size: 15px;
  font-weight: 500;
}

.card-item .card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-light);
  flex-wrap: wrap;
}

.card-item .card-body {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.badge.success { background: #e6f9ec; color: var(--success); }
.badge.danger { background: #ffeef0; color: var(--danger); }
.badge.warning { background: #fff5e6; color: var(--warning); }
.badge.info { background: #e8f3ff; color: var(--primary); }
.badge.gray { background: #f2f3f5; color: var(--text-light); }

.ranking-list {
  padding: 0 12px;
}

.rank-item {
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-num.gold { background: linear-gradient(135deg, #ffd700, #ffb800); color: #fff; }
.rank-num.silver { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); color: #fff; }
.rank-num.bronze { background: linear-gradient(135deg, #cd7f32, #b8693d); color: #fff; }
.rank-num.normal { background: #f2f3f5; color: var(--text-light); }

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-info .name {
  font-size: 14px;
  font-weight: 500;
}

.rank-info .stats {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.rank-value {
  text-align: right;
  flex-shrink: 0;
}

.rank-value .num {
  font-size: 18px;
  font-weight: 700;
}

.rank-value .label {
  font-size: 11px;
  color: var(--text-light);
}

.search-bar {
  padding: 10px 12px;
  background: #fff;
}

.search-bar input {
  width: 100%;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0 16px;
  font-size: 13px;
  outline: none;
}

.filter-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.filter-bar .filter-chip {
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.filter-bar .filter-chip.active {
  background: #e8f3ff;
  color: var(--primary);
  border-color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

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

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h3 { font-size: 16px; }

.modal-close {
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
  border: none;
  background: none;
}

.modal-body { padding: 16px; }

.modal-body .form-group {
  margin-bottom: 12px;
}

.modal-body label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}

.modal-body textarea {
  height: 80px;
  padding: 8px 12px;
  resize: vertical;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.modal-footer .btn { flex: 1; }

.score-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: #f2f3f5;
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}

.score-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.intent-high { color: var(--success); }
.intent-medium { color: var(--warning); }
.intent-low { color: var(--text-light); }

.script-block { padding: 4px 0; }
.script-dimension { margin-bottom: 14px; }
.script-dimension .dim-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 4px;
}
.script-dimension .dim-name { font-weight: 500; color: var(--text); }
.script-dimension .dim-score { font-weight: 600; }
.script-dimension .dim-bar {
  height: 6px;
  background: #f2f3f5;
  border-radius: 3px;
  overflow: hidden;
}
.script-dimension .dim-bar .fill { height: 100%; border-radius: 3px; }
.script-dimension .dim-comment {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
  line-height: 1.5;
}
.script-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  background: #f7f8fa;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
}

.task-progress {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 12px 8px;
}
.task-progress .tp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.task-progress .tp-title { font-size: 14px; font-weight: 500; }
.task-progress .tp-rate { font-size: 16px; font-weight: 700; color: var(--success); }
.task-progress .tp-bar {
  height: 8px;
  background: #e8eaec;
  border-radius: 4px;
  overflow: hidden;
}
.task-progress .tp-fill { height: 100%; background: var(--success); border-radius: 4px; }
.task-progress .tp-fill.partial { background: var(--warning); }
.task-progress .tp-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-light);
}

.task-done { opacity: 0.62; }
.task-done .card-title { text-decoration: line-through; }

.call-detail-page {
  background: #fff;
  min-height: 100vh;
}

.call-detail-page .detail-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.call-detail-page .detail-section {
  padding: 16px;
  border-bottom: 8px solid var(--bg);
}

.call-detail-page .detail-section h4 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
}

.call-detail-page .detail-section p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.ai-score-box {
  text-align: center;
  padding: 20px;
}

.ai-score-box .score {
  font-size: 48px;
  font-weight: 700;
}

.ai-score-box .score-label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.toast.show { opacity: 1; }

.chart-container {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin: 0 12px 8px;
}

.chart-container h4 {
  font-size: 14px;
  margin-bottom: 12px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding-top: 10px;
}

.bar-chart .bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bar-chart .bar {
  width: 100%;
  max-width: 30px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s;
}

.bar-chart .bar.answered { background: var(--success); }
.bar-chart .bar.missed { background: #e0e0e0; }

.bar-chart .bar-label {
  font-size: 10px;
  color: var(--text-light);
}

.import-area {
  padding: 12px;
}

.import-area textarea {
  width: 100%;
  height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  font-family: monospace;
}

.import-area .hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
}

.site-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  padding: 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--text-light); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
