:root {
  --bg: #f4f6fb;
  --bg2: #eef1f8;
  --card: #ffffff;
  --line: #e7eaf1;
  --text: #18223a;
  --muted: #8a93a6;
  --primary: #FF8A00;
  --primary2: #FF5722;
  --primary-grad: linear-gradient(135deg, #FF8A00 0%, #FF5722 100%);
  --brand: #FF8A00;
  --green: #16a34a;
  --green-bg: #e7f6ee;
  --red: #e11d48;
  --red-bg: #fdeaee;
  --amber: #b45309;
  --shadow: 0 6px 24px rgba(20,30,60,.06);
  --shadow-lg: 0 16px 48px rgba(20,30,60,.12);
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f7f8fc 0%, #eef1f8 100%) fixed;
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 18px;
  box-shadow: var(--shadow);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--red); min-height: 18px; margin: 6px 0; font-size: 13px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 5px; font-weight: 500; }

input, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,138,0,.12); }

button {
  padding: 10px 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  cursor: pointer; font-size: 14px; color: var(--text); transition: all .15s ease;
}
button:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(20,30,60,.10); }
button:active { transform: translateY(0); }
button.primary { background: var(--primary-grad); color: #fff; border: none; font-weight: 600; box-shadow: 0 6px 18px rgba(255,138,0,.30); }
button.primary:hover { box-shadow: 0 8px 24px rgba(255,138,0,.40); border: none; }
button.ghost { background: #fff; color: var(--text); }
button.ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 登录 ---------- */
.login-card {
  max-width: 380px; margin: 11vh auto 0; background: #fff;
  border: 1px solid var(--line); border-radius: 20px; padding: 36px 32px 30px;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--primary-grad);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: .5px; }
.login-card .brand-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px;
  background: var(--brand); vertical-align: middle;
}
.login-card label { margin-top: 16px; }
.login-card input { padding: 12px 14px; font-size: 15px; }
.login-card button { margin-top: 22px; padding: 12px 18px; font-size: 15px; border-radius: 12px; }
.login-card .muted.small { margin-top: 18px; line-height: 1.6; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 26px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 12px rgba(20,30,60,.04);
}
.topbar > div:first-child { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.topbar .brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--primary-grad);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 12px rgba(255,138,0,.35);
}
.topbar strong { font-weight: 700; letter-spacing: .3px; }

/* ---------- 标签 ---------- */
.tabs { display: flex; gap: 10px; padding: 16px 26px 0; }
.tab {
  border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 9px 22px; font-size: 14px; color: var(--muted);
}
.tab:hover { transform: none; box-shadow: none; border-color: var(--line); color: var(--text); }
.tab.active { background: var(--primary-grad); color: #fff; border-color: transparent; font-weight: 600; box-shadow: 0 6px 16px rgba(255,138,0,.30); }

/* ---------- 筛选条 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filters > div { min-width: 150px; }
.filters button { height: 42px; }
.filters button.primary { min-width: 110px; }

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 0 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; position: relative; overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--primary-grad); }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.stat .num { font-size: 32px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; color: var(--text); }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.platform .num { color: var(--primary); }
.stat-group-title { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 14px; }
th {
  color: var(--muted); font-weight: 600; font-size: 12px; background: #f7f8fc;
  position: sticky; top: 0; z-index: 1; letter-spacing: .03em;
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f9fafd; }
td { color: var(--text); }

.tag { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.tag.in { background: var(--green-bg); color: var(--green); }
.tag.out { background: #eef2ff; color: var(--primary); }
.tag.missed { background: var(--red-bg); color: var(--red); }
.tag.unk { background: #f1f2f6; color: var(--muted); }
audio { height: 34px; }
.rec-wrap { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.rec-wrap audio { flex: 1; min-width: 150px; }
.rec-wrap .link { text-decoration: none; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 14px 4px 0; }
.agent-row td:first-child { font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,20,40,.45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; border-radius: 18px; padding: 26px 28px; width: 380px; max-width: 92vw; box-shadow: var(--shadow-lg); }
.modal-box h3 { margin: 0 0 6px; font-size: 18px; }
.modal-box label { margin-top: 14px; }
.modal-box input, .modal-box select { padding: 11px 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link { border: none; background: none; color: var(--primary); padding: 2px 6px; cursor: pointer; font-size: 14px; }
.link:hover { box-shadow: none; transform: none; text-decoration: underline; }
.link.danger { color: var(--red); }
