/* Echo LLM Server · 共享设计系统（紧凑、干净、暗色） */
:root {
  --bg: #0d1017;
  --bg2: #12151d;
  --panel: #171b24;
  --panel2: #1d2230;
  --border: #262c3a;
  --border2: #313848;
  --text: #e7eaf0;
  --muted: #8b93a7;
  --faint: #5c6478;
  --accent: #6ea8fe;
  --accent2: #3b82f6;
  --green: #3fb96f;
  --amber: #d9a13c;
  --violet: #a371f7;
  --red: #e5584f;
  --cyan: #45c4d8;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(110,168,254,.28); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2c3342; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border2); border-radius: 8px;
  padding: 6px 14px; font-size: 12.5px; cursor: pointer;
  transition: .15s; user-select: none; white-space: nowrap;
}
.btn:hover { background: #242b3b; border-color: #3d4658; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #4a8df8; }
.btn.danger { color: #ff8a82; border-color: rgba(229,88,79,.4); background: rgba(229,88,79,.08); }
.btn.danger:hover { background: rgba(229,88,79,.18); }
.btn.green { color: #7ee2a8; border-color: rgba(63,185,111,.45); background: rgba(63,185,111,.1); }
.btn.green:hover { background: rgba(63,185,111,.2); }
.btn.sm { padding: 3px 9px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---- 输入 ---- */
.input, .textarea, .select {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; outline: none; transition: .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.textarea { resize: vertical; min-height: 74px; font-family: inherit; line-height: 1.55; }
.select { cursor: pointer; }
label.field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
label.field .input, label.field .textarea { margin-top: 5px; }

/* ---- 卡片 / 徽标 / 状态点 ---- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 1.5px 8px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--border2); color: var(--muted);
}
.chip.blue { color: #9cc2ff; border-color: rgba(110,168,254,.35); background: rgba(110,168,254,.08); }
.chip.green { color: #85e0aa; border-color: rgba(63,185,111,.35); background: rgba(63,185,111,.08); }
.chip.amber { color: #ecc07c; border-color: rgba(217,161,60,.35); background: rgba(217,161,60,.08); }
.chip.violet { color: #c6a6fb; border-color: rgba(163,113,247,.35); background: rgba(163,113,247,.08); }
.chip.red { color: #ff9a93; border-color: rgba(229,88,79,.35); background: rgba(229,88,79,.08); }
.chip.cyan { color: #8adcea; border-color: rgba(69,196,216,.35); background: rgba(69,196,216,.08); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 6px rgba(63,185,111,.8); }
.dot.off { background: var(--faint); }
.dot.pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 2px; background: var(--bg2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.tabs button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.tabs button.active { background: var(--panel2); color: var(--text); font-weight: 600; }
.tabs button em { font-style: normal; background: var(--accent2); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 10.5px; margin-left: 4px; }
.tabs button em.zero { background: var(--faint); }

/* ---- 表格 ---- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; color: var(--faint); font-weight: 500; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid rgba(38,44,58,.6); vertical-align: top; }
.tbl tr:hover td { background: rgba(110,168,254,.04); }

/* ---- 消息气泡（数据流视图） ---- */
.msg { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; overflow: hidden; background: var(--panel); }
.msg-head {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px;
  font-size: 10.5px; letter-spacing: .06em; color: var(--faint);
  border-bottom: 1px solid rgba(38,44,58,.5); text-transform: uppercase;
}
.msg-body { padding: 9px 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.msg-body .txt + .txt { margin-top: 6px; }
.msg-system { border-color: rgba(163,113,247,.28); }
.msg-system .msg-head { color: #b28ffb; background: rgba(163,113,247,.06); }
.msg-system .msg-body { color: #cbb8f5; font-size: 12.5px; }
.msg-user { border-color: rgba(110,168,254,.3); }
.msg-user .msg-head { color: #8fbcff; background: rgba(110,168,254,.06); }
.msg-assistant { border-color: rgba(63,185,111,.3); }
.msg-assistant .msg-head { color: #7edaa4; background: rgba(63,185,111,.06); }
.msg-tool { border-color: rgba(69,196,216,.3); }
.msg-tool .msg-head { color: #7fd8e8; background: rgba(69,196,216,.06); }
.msg-other { opacity: .85; }
.msg-img { max-width: 100%; max-height: 200px; border-radius: 8px; border: 1px solid var(--border2); cursor: zoom-in; display: block; margin-top: 4px; }
.msg-new { box-shadow: 0 0 0 1px rgba(217,161,60,.55), 0 0 14px rgba(217,161,60,.12); }
.badge-new { font-size: 10px; color: #0d1017; background: var(--amber); border-radius: 4px; padding: 0 5px; font-weight: 700; margin-left: auto; }

/* 工具调用卡片 */
.toolcard { border: 1px solid rgba(217,161,60,.35); background: rgba(217,161,60,.05); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.toolcard .tc-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 11px; color: #ecc07c; border-bottom: 1px solid rgba(217,161,60,.2); }
.toolcard pre { padding: 8px 12px; font-size: 11.5px; font-family: var(--mono); color: #d8c9a3; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* ---- 代码块 ---- */
.code {
  background: #0a0d13; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.7;
  overflow-x: auto; color: #c9d4e8; white-space: pre; position: relative;
}
.code .copy { position: absolute; top: 8px; right: 8px; opacity: 0; transition: .15s; }
.code:hover .copy { opacity: 1; }

/* ---- Toast / 弹层 ---- */
#toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: var(--panel2); border: 1px solid var(--border2); color: var(--text);
  padding: 8px 18px; border-radius: 10px; font-size: 13px; z-index: 999;
  opacity: 0; pointer-events: none; transition: .25s; box-shadow: 0 8px 30px rgba(0,0,0,.45);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#imgOverlay {
  position: fixed; inset: 0; background: rgba(5,7,10,.88); z-index: 1000;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 30px;
}
#imgOverlay img { max-width: 96%; max-height: 92%; border-radius: 10px; }
.modal-bg { position: fixed; inset: 0; background: rgba(5,7,10,.7); z-index: 900; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--panel); border: 1px solid var(--border2); border-radius: 12px; padding: 18px; width: min(520px, 92vw); max-height: 84vh; overflow: auto; }

/* ---- 头部栏 ---- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 46px;
  background: rgba(18,21,29,.92); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; letter-spacing: .02em; }
.brand .logo {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, #6ea8fe, #a371f7);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff;
}
