/* 远程控制台样式 — 暗色运维风 */
:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1f2630;
  --line: #2d333b;
  --fg: #e6edf3;
  --dim: #8b949e;
  --acc: #3fb950;
  --acc2: #58a6ff;
  --warn: #d29922;
  --err: #f85149;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--fg); font-size: 14px;
}
.hidden { display: none !important; }
.dim { color: var(--dim); font-size: 12px; }

/* ---------- 登录 ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  width: 340px; padding: 40px 32px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 12px; text-align: center;
}
.login-logo { font-size: 44px; }
.login-card h1 { font-size: 20px; margin: 10px 0 4px; }
.login-sub { color: var(--dim); font-size: 12px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; outline: none;
}
.login-card input:focus { border-color: var(--acc2); }
.login-card button {
  width: 100%; padding: 10px; background: var(--acc2); color: #04121f;
  border: 0; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.login-err { color: var(--err); font-size: 12px; margin-top: 10px; min-height: 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 48px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 600; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.stat-chip {
  font-size: 12px; color: var(--acc); background: rgba(63,185,80,.12);
  padding: 3px 10px; border-radius: 20px;
}

/* ---------- 布局 ---------- */
.layout { display: flex; height: calc(100vh - 48px); }
.sidebar {
  width: 260px; background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.side-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line);
}
.agent-list { list-style: none; overflow-y: auto; flex: 1; }
.agent-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid rgba(45,51,59,.5);
  display: flex; align-items: center; gap: 8px;
}
.agent-item:hover { background: var(--bg3); }
.agent-item.active { background: var(--bg3); border-left: 2px solid var(--acc2); }
.agent-item .a-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-item .a-os { color: var(--dim); font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: var(--acc); box-shadow: 0 0 6px var(--acc); }
.dot.off { background: var(--dim); }

.content { flex: 1; overflow-y: auto; padding: 16px; }
.empty-tip { text-align: center; margin-top: 18vh; color: var(--dim); }
.empty-ico { font-size: 40px; margin-bottom: 12px; }

.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; margin-bottom: 14px;
}
.agent-title { display: flex; align-items: center; gap: 10px; }
.agent-title h2 { font-size: 17px; flex: 1; }
.agent-meta { margin-top: 10px; color: var(--dim); font-size: 12px; line-height: 1.8; }

.exec-bar { display: flex; gap: 8px; }
.sel {
  background: var(--bg); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; outline: none;
}
.cmd-input {
  flex: 1; background: var(--bg); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font-family: Consolas, monospace; outline: none;
}
.cmd-input:focus { border-color: var(--acc2); }
.exec-out {
  margin-top: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; min-height: 140px; max-height: 380px; overflow: auto;
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-all; color: #c9d1d9;
}
.exec-out:empty::before { content: attr(placeholder); color: var(--dim); }

.card-title { font-weight: 600; margin-bottom: 10px; }
.hist-list { list-style: none; max-height: 300px; overflow-y: auto; }
.hist-item {
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
  display: flex; gap: 8px; align-items: baseline;
}
.hist-item:hover { background: var(--bg3); }
.hist-item .h-cmd { font-family: Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.hist-item .h-ok { color: var(--acc); }
.hist-item .h-fail { color: var(--err); }
.hist-item .h-time { color: var(--dim); font-size: 11px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--fg); background: var(--bg3);
}
.btn:hover { filter: brightness(1.15); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.primary { background: var(--acc2); color: #04121f; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--dim); }
.btn.ghost:hover { color: var(--fg); }
.btn.danger { background: transparent; border: 1px solid rgba(248,81,73,.4); color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(1,4,9,.72); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  width: min(1100px, 94vw); height: min(700px, 90vh); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column;
}
.modal-box.small { width: min(460px, 94vw); height: auto; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.term-area { flex: 1; padding: 8px; overflow: hidden; background: #000; }
#termEl { width: 100%; height: 100%; }
.term-status {
  padding: 6px 14px; font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--line);
}
.ssh-form { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.ssh-form label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.ssh-fields { display: flex; flex-direction: column; gap: 8px; padding-left: 22px; }
.ssh-fields input, .ssh-fields button { width: 100%; }
.ssh-fields input {
  background: var(--bg); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; outline: none;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--line); color: var(--fg);
  padding: 10px 18px; border-radius: 10px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  max-width: 70vw; font-size: 13px;
}
.toast.err { border-color: rgba(248,81,73,.5); color: #ffb3ad; }
