:root {
  --bg: #f6f7f9;
  --panel: #fff;
  --line: rgba(0, 0, 0, .08);
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #185fa5;
  --accent-weak: #e6f1fb;
  --ok: #1d9e75;
  --warn: #b26a00;
  --bad: #d14343;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 28px; line-height: 1.35; }
h2 { font-size: 14px; }
h3 { font-size: 15px; }

a { color: var(--accent); }

/* ---------- 表单元素 ---------- */
input, select, button { font: inherit; }

input[type=text], input[type=password], select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  color: var(--text);
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}

.btn:hover { background: #f2f4f6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #134e87; }
.btn.mini { padding: 3px 9px; font-size: 12px; }
.btn.link { border: none; background: none; color: var(--accent); padding: 3px 6px; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn.danger { color: var(--bad); }
.btn.tiny { padding: 2px 7px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }

.fine { color: var(--muted); font-size: 12px; line-height: 1.7; }
.mono { font-family: var(--mono); font-size: 12px; }
.sub { color: var(--muted); font-size: 12px; }

/* ---------- 登录页 ---------- */
body.auth { min-height: 100vh; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
}

.auth-brand {
  padding: 56px 60px;
  color: #eaf1f8;
  background: linear-gradient(150deg, #0f2338 0%, #173a5e 55%, #185fa5 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  justify-content: center;
}

.auth-brand .logo { font-size: 15px; letter-spacing: .06em; color: #9ec6ea; }
.auth-brand h1 { font-size: 30px; }
.auth-brand ul { margin: 0; padding-left: 18px; color: #cfe0f0; line-height: 2; }
.auth-brand .fine { color: #8aa8c2; margin-top: auto; }

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px clamp(28px, 7vw, 90px);
  background: #fff;
}

.auth-tabs { display: flex; gap: 6px; margin-bottom: 22px; }

.tab-btn {
  border: none;
  background: none;
  padding: 7px 4px;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

#form { display: grid; gap: 16px; }
#form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
#form input { width: 100%; padding: 10px 12px; }
.hint { margin: 0; min-height: 18px; font-size: 12px; color: var(--muted); }
.hint.bad { color: var(--bad); }

/* ---------- 控制台 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand { font-weight: 600; letter-spacing: .02em; }
.tabs { display: flex; gap: 4px; }

.tab {
  border: none;
  background: none;
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}

.tab:hover { background: var(--bg); }
.tab.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user .who { color: var(--muted); font-size: 13px; }

.pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
}

.pill.ok { background: #eaf3de; color: #3f6b17; border-color: #d7e8bd; }
.pill.bad { background: #fdecec; color: var(--bad); border-color: #f6d3d3; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; display: grid; gap: 16px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: grid;
  gap: 2px;
}

.stat label { color: var(--muted); font-size: 12px; }
.stat b { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.stat small { color: var(--muted); font-size: 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.panel-head h2 { font-size: 13px; }
.panel-head .note { margin-left: auto; color: var(--muted); font-size: 12px; }
.add { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.add input[type=text] { width: 230px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.grid td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: #fbfcfd; }
.ops { text-align: right; white-space: nowrap; }
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.recording { color: var(--bad); }
.recording .dot { background: var(--bad); animation: pulse 1.4s ease-in-out infinite; }
.waiting .dot { background: #b4b2a9; }
.paused { color: var(--warn); }
.paused .dot { background: var(--warn); }
.error { color: var(--bad); }
.error .dot { background: var(--bad); }
.offline { color: var(--bad); }
.offline .dot { background: var(--bad); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.err { color: var(--bad); font-size: 11px; margin-top: 3px; }

.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 套餐 ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 16px; }

.plan {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
  position: relative;
}

.plan.hot { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.plan .price b { font-size: 26px; }
.plan .price span { color: var(--muted); font-size: 12px; margin-left: 4px; }

.ribbon {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-weak);
  border-radius: 999px;
  padding: 2px 8px;
}

.redeem { padding: 4px 16px 20px; display: grid; gap: 8px; }
.redeem .add { margin-left: 0; }
.redeem input[type=text] { width: 260px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 22, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.modal[hidden] { display: none; }

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 26px 28px;
  text-align: center;
  display: grid;
  gap: 12px;
  min-width: 300px;
}

.code {
  font-family: var(--mono);
  font-size: 34px;
  letter-spacing: .28em;
  color: var(--accent);
  padding: 8px 0;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: #1f2328;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 80;
  max-width: 80vw;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: #a32d2d; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding: 34px 28px; }
  .auth-brand h1 { font-size: 22px; }
  .auth-brand ul { display: none; }
  .auth-panel { padding: 34px 24px 60px; }
  .plans { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .wrap { padding: 16px; }
  .add input[type=text] { width: 100%; }
  table.grid { display: block; overflow-x: auto; white-space: nowrap; }
}
