* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #1a1a2e;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部状态栏 ===== */
.header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  z-index: 10;
  flex-wrap: wrap;
  gap: 8px;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-on  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.dot-off { background: #ef4444; }

.mode-switch {
  display: flex;
  gap: 4px;
  background: #eef1f6;
  padding: 3px;
  border-radius: 8px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn.active {
  background: #fff;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* ===== 房间号栏 ===== */
.room-bar {
  background: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eef1f6;
  flex-wrap: wrap;
}
.room-label {
  font-size: 13px;
  color: #555;
  font-weight: 600;
}
#roomInput {
  flex: 1;
  min-width: 80px;
  max-width: 140px;
  font-size: 16px;
  padding: 8px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  font-weight: 700;
  color: #2563eb;
}
#roomInput:focus { border-color: #2563eb; }
.room-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.room-btn:active { transform: scale(0.97); }
.share-btn { background: #22c55e; }
.share-btn:active { background: #16a34a; }

/* ===== 通用视图 ===== */
.view {
  padding: 18px 16px 40px;
  max-width: 640px;
  margin: 0 auto;
}
.hidden { display: none !important; }

.title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1a1a2e;
}

/* ===== 发送端 ===== */
.sender-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

#numberInput {
  flex: 1;
  font-size: 24px;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  text-align: center;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
#numberInput:focus { border-color: #2563eb; }

.primary-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  min-height: 56px;
}
.primary-btn:active { transform: scale(0.97); background: #1d4ed8; }

.ghost-btn {
  background: #fff;
  color: #555;
  border: 1px solid #d1d5db;
  padding: 0 18px;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
}

.last-call {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  min-height: 60px;
  display: flex;
  align-items: center;
  font-size: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.quick-tip {
  color: #888;
  font-size: 12px;
  margin-bottom: 16px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
}

.quick-btn {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 0;
  font-size: 14px;
  cursor: pointer;
  color: #2563eb;
  transition: all 0.15s;
}
.quick-btn:active { background: #2563eb; color: #fff; }

/* ===== 接收端 + 语音播报 ===== */
.alert-options {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.alert-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1a1a2e;
}
.alert-options .switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
  color: #444;
}
.alert-options .switch-label input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}
.rate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
  color: #555;
}
.rate-row input[type="range"] {
  flex: 1;
  accent-color: #2563eb;
}
.rate-text { min-width: 32px; }

#testAlertBtn { margin-top: 10px; font-size: 13px; padding: 6px 14px; min-height: auto; }

.display-card {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  border-radius: 20px;
  padding: 40px 20px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
  margin-bottom: 16px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.display-number {
  font-size: 80px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -2px;
}

.display-name {
  font-size: 32px;
  font-weight: 500;
  word-break: break-all;
}

.display-card.flash {
  animation: flash 0.5s ease;
}
@keyframes flash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); box-shadow: 0 10px 40px rgba(37, 99, 235, 0.5); }
  100% { transform: scale(1); }
}

.receiver-controls {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
  margin-bottom: 16px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.switch-label input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

#rateRange {
  flex: 1;
  min-width: 100px;
  accent-color: #2563eb;
}

.rate-text {
  color: #666;
  font-size: 13px;
  white-space: nowrap;
}

.history {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  max-height: 220px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: #555;
}
.history-item:last-child { border-bottom: none; }
.history-item .num {
  color: #2563eb;
  font-weight: 600;
  width: 40px;
}
.history-item .name { flex: 1; }
.history-item .time { color: #999; font-size: 12px; }

/* ===== 名单管理 ===== */
.hint {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
  line-height: 1.6;
}
.hint code {
  background: #eef1f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Consolas", monospace;
}

.names-editor {
  width: 100%;
  min-height: 320px;
  padding: 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: "Consolas", "PingFang SC", monospace;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
.names-editor:focus { border-color: #2563eb; }

.manager-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.save-tip {
  font-size: 13px;
  color: #22c55e;
  font-weight: 500;
}

/* ===== 请假管理 ===== */
.leave-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
}
.leave-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 10px;
}
.leave-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.leave-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}
.leave-item.checked {
  background: #fff7ed;
  border-color: #f59e0b;
}
.leave-item input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: #f59e0b;
  flex-shrink: 0;
}
.leave-num {
  color: #2563eb;
  font-weight: 600;
  min-width: 28px;
}
.leave-name {
  flex: 1;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leave-tag {
  font-size: 11px;
  color: #f59e0b;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.leave-item.checked .leave-tag { opacity: 1; }

.empty-tip {
  color: #94a3b8;
  font-size: 13px;
  padding: 12px;
  text-align: center;
  font-style: italic;
}

/* ===== 统计 ===== */
.stats-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.stats-time {
  font-size: 12px;
  color: #94a3b8;
}

.stats-summary {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.s-num {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
}
.s-num.green { color: #22c55e; }
.s-num.red { color: #ef4444; }
.s-num.gray { color: #94a3b8; }
.s-label {
  font-size: 12px;
  color: #666;
}

.progress-bar {
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: 4px;
  transition: width 0.4s;
}
.progress-text {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-top: 6px;
}

.stats-block {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stats-h3 {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-gray { background: #f1f5f9; color: #64748b; }

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stats-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.stats-item.uncalled {
  background: #fef2f2;
  border-left: 3px solid #ef4444;
}
.stats-item.called {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
}
.stats-item.leave {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}
.stats-num {
  font-weight: 600;
  color: #2563eb;
  min-width: 36px;
}
.stats-name {
  flex: 1;
  color: #333;
}
.stats-time {
  font-size: 12px;
  color: #94a3b8;
}
