:root {
  --bg: #0f1420;
  --panel: #182031;
  --panel-2: #1f293c;
  --line: #2b3550;
  --text: #e8edf7;
  --muted: #97a3bb;
  --primary: #2f7df6;
  --primary-dark: #2568d0;
  --danger: #e04b4b;
  --ok: #35c07d;
  --warn: #e5a83b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 600; }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(151, 163, 187, .15);
}
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(53, 192, 125, .18); }
.dot.busy { background: var(--warn); box-shadow: 0 0 0 3px rgba(229, 168, 59, .18); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(224, 75, 75, .18); }

.topbar-right { color: var(--muted); font-size: 12px; display: flex; gap: 8px; }
.sep { opacity: .4; }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 380px minmax(360px, 1fr);
  gap: 16px;
  padding: 16px;
  align-items: start;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.card h2 { font-size: 14px; margin: 0 0 12px; font-weight: 600; color: var(--text); }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.head-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 表单与按钮 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }

input[type="tel"] {
  width: 100%;
  padding: 11px 12px;
  font-size: 20px;
  letter-spacing: .5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
input[type="tel"]:focus { border-color: var(--primary); }
input[type="tel"]:disabled { opacity: .55; }

.actions { display: flex; gap: 8px; }

.btn {
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { background: #24304a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #c93f3f; }
.btn.ghost { background: transparent; }
.btn.ghost.active { background: var(--warn); border-color: var(--warn); color: #241a05; }
.btn.small { padding: 5px 10px; font-size: 12px; }

/* ---------- 通话状态 ---------- */
.callstate {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 12px;
  padding: 10px 12px;
  background: var(--panel-2);
  border-radius: 8px;
}

.phase { font-size: 15px; font-weight: 600; }
.phase.idle { color: var(--muted); }
.phase.dialing { color: var(--warn); }
.phase.ringing { color: var(--warn); }
.phase.retrying { color: var(--warn); }
.phase.talking { color: var(--ok); }
.phase.ended { color: var(--muted); }

.timer { font-variant-numeric: tabular-nums; color: var(--muted); }
.state-right { display: flex; align-items: center; gap: 10px; }
.buffer { color: #66748f; font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- 电平条 ---------- */
.meters { display: grid; gap: 8px; }
.meter-row { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 8px; }
.meter-label { color: var(--muted); font-size: 12px; }

.meter {
  height: 8px;
  background: #101725;
  border-radius: 5px;
  overflow: hidden;
}
.meter > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ok), #7ddc9f);
  transition: width .08s linear;
}
.meter.remote > i { background: linear-gradient(90deg, var(--primary), #8fc0ff); }

/* ---------- 提示与日志 ---------- */
.hint { color: var(--muted); font-size: 12px; min-height: 18px; margin: 12px 0 8px; }
.hint.error { color: #ff9b9b; }
.hint.warn { color: var(--warn); }
.hint.ok { color: #8fe0b4; }

.log {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px dashed var(--line);
  max-height: 150px;
  overflow: auto;
  font-size: 12px;
  color: var(--muted);
}
.log li { padding: 2px 0; }
.log li time { color: #66748f; margin-right: 6px; font-variant-numeric: tabular-nums; }

/* ---------- 录音列表 ---------- */
.muted { color: var(--muted); font-size: 12px; }
.list { display: grid; gap: 10px; max-height: 70vh; overflow: auto; }

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.item .meta { display: grid; gap: 3px; }
.item .called { font-size: 15px; font-weight: 600; }
.item .sub { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.item .name { color: #65718d; font-size: 11px; word-break: break-all; }
.item .ops { display: flex; align-items: center; gap: 8px; }
.item audio { height: 32px; width: 230px; }

@media (max-width: 640px) {
  .item { grid-template-columns: 1fr; }
  .item audio { width: 100%; }
}
