:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-weak: #eaf0ff;
  --in: #0f766e;
  --out: #6d28d9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.token { width: 200px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.health { font-size: 13px; color: var(--muted); }
.health.ok { color: var(--in); }
.health.bad { color: #b91c1c; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 14px;
  padding: 14px;
  align-items: start;
}
.col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.col h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.row { display: flex; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
label { font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
input, textarea {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  width: 100%;
}
textarea { resize: vertical; }
button {
  font: inherit;
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: var(--accent-weak); color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; }

.list { list-style: none; margin: 0; padding: 0; }
.list.small li { font-size: 12px; }
.list li {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 6px;
  cursor: pointer;
}
.list li.active { border-color: var(--accent); background: var(--accent-weak); }
.list li .addr { font-weight: 600; }
.list li .meta { font-size: 12px; color: var(--muted); }

.messages { display: flex; flex-direction: column; gap: 8px; }
.msg {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.msg.active { border-color: var(--accent); }
.msg .line1 { display: flex; justify-content: space-between; gap: 8px; }
.msg .subject { font-weight: 600; }
.msg .dir { font-size: 11px; padding: 1px 7px; border-radius: 10px; color: #fff; }
.msg .dir.inbound { background: var(--in); }
.msg .dir.outbound { background: var(--out); }
.msg .from { font-size: 12px; color: var(--muted); }
.msg .body { margin-top: 6px; font-size: 13px; white-space: pre-wrap; color: #333; }
.empty { color: var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2430;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
