/* 智慧工牌音频接收服务 - 简洁专业浅色主题 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}

/* 顶栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); padding: 14px 24px; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { color: var(--primary); font-size: 20px; }
.brand h1 { font-size: 18px; font-weight: 600; }
.backend-info { display: flex; gap: 8px; }
.badge {
  padding: 4px 12px; border-radius: 999px; font-size: 12px;
  background: #dbeafe; color: var(--primary-dark);
}
.badge.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.badge.err { background: #fee2e2; color: var(--danger); }

/* 统计卡片 */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; padding: 20px 24px;
}
.stat-card {
  background: var(--panel); border-radius: 10px; padding: 18px 20px;
  border: 1px solid var(--border);
}
.stat-card.warn .stat-num { color: var(--warn); }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--muted); margin-top: 4px; font-size: 13px; }

/* Tab */
.tabs {
  display: flex; gap: 4px; padding: 0 24px;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 10px 20px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

main { padding: 20px 24px; }
.panel { display: none; }
.panel.active { display: block; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; min-width: 180px; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }

.btn {
  padding: 8px 18px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 14px;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.icon {
  background: transparent; color: var(--muted); font-size: 20px;
  padding: 2px 10px; border: none;
}
.btn.sm { padding: 5px 12px; font-size: 13px; }

/* 表格 */
.table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border-radius: 10px; overflow: hidden; border: 1px solid var(--border);
}
.table th, .table td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.table .empty { text-align: center; color: var(--muted); padding: 40px; }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.tag.ok { background: #d1fae5; color: var(--ok); }
.tag.pending { background: #fef3c7; color: var(--warn); }
.tag.fail { background: #fee2e2; color: var(--danger); }
.tag.info { background: #dbeafe; color: var(--primary-dark); }

.ops { display: flex; gap: 6px; flex-wrap: wrap; }

.pager {
  display: flex; align-items: center; gap: 14px;
  margin-top: 14px; justify-content: center; color: var(--muted);
}

.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
pre.json-view {
  background: #f9fafb; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; max-height: 220px; overflow: auto; font-size: 12px;
  white-space: pre-wrap; word-break: break-all;
}

/* 播放弹层 */
.modal-mask {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  align-items: center; justify-content: center; z-index: 50;
}
.modal-mask.open { display: flex; }
.modal {
  background: var(--panel); border-radius: 12px; width: min(560px, 92vw);
  padding: 20px 24px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { font-size: 16px; word-break: break-all; }
.modal-body audio { width: 100%; }
.modal-meta { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.8; }

/* Toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 22px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99; font-size: 14px;
}
.toast.show { opacity: 1; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .toolbar input, .toolbar select { min-width: 120px; }
}
