/* 羊羊科技工具箱 · Web 控制台样式（深色主题） */
:root {
  --bg: #0e1117;
  --bg-2: #161b22;
  --bg-3: #1c2230;
  --panel: #161b22;
  --border: #2b3340;
  --border-hi: #3a4658;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --text-mute: #6e7681;
  --accent: #f0b429;
  --accent-2: #ffd866;
  --green: #3fb950;
  --red: #f85149;
  --blue: #58a6ff;
  --purple: #bc8cff;
  --cyan: #39c5cf;
  --shadow: 0 8px 24px rgba(0,0,0,.4);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: var(--blue); text-decoration: none; }

/* ===== 登录页 ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 0%, #1b2433 0%, var(--bg) 60%);
  min-height: 100vh;
}
.login-card {
  width: 380px; max-width: 92vw;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo { font-size: 52px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; color: var(--accent); }
.login-sub { color: var(--text-dim); margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 12px 14px;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border-hi); border-radius: 8px;
  outline: none; margin-bottom: 12px;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%; padding: 12px;
  background: var(--accent); color: #1a1405;
  font-weight: 700; border: none; border-radius: 8px;
  cursor: pointer; transition: .15s;
}
.login-card button:hover { background: var(--accent-2); }
.login-card button:disabled { opacity: .6; cursor: wait; }
.login-err { color: var(--red); min-height: 20px; font-size: 13px; }
.login-foot { margin-top: 20px; color: var(--text-mute); font-size: 12px; }

/* ===== 布局 ===== */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-size: 17px; font-weight: 700; color: var(--accent); }
.topbar .brand span { font-size: 20px; }
.topbar .spacer { flex: 1; }
.topbar .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; margin-right: 6px; }
.topbar .status-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.topbar .conn { color: var(--text-dim); font-size: 12px; }
.topbar button {
  background: var(--bg-3); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
.topbar button:hover { color: var(--text); border-color: var(--border-hi); }

.main { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 220px; flex: 0 0 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
}
.sidebar .nav-title {
  color: var(--text-mute); font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; padding: 10px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 7px;
  color: var(--text-dim); cursor: pointer;
  transition: .12s; user-select: none;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: rgba(240,180,41,.12); color: var(--accent); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view {
  flex: 1; overflow-y: auto; padding: 24px 28px;
}
.view.hidden { display: none; }
.view-head { margin-bottom: 20px; }
.view-head h2 { font-size: 20px; margin-bottom: 4px; }
.view-head p { color: var(--text-dim); font-size: 13px; }

/* ===== 任务卡片 ===== */
.group-title { font-size: 13px; color: var(--text-mute); margin: 22px 0 12px; font-weight: 600; letter-spacing: .5px; }
.group-title:first-child { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: .15s;
}
.card:hover { border-color: var(--border-hi); transform: translateY(-2px); box-shadow: var(--shadow); }
.card .card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card .card-ico {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; background: rgba(240,180,41,.1); color: var(--accent);
}
.card h3 { font-size: 15px; font-weight: 600; }
.card p { color: var(--text-dim); font-size: 12px; min-height: 36px; margin-bottom: 14px; }
.card .run-btn {
  width: 100%; padding: 8px;
  background: var(--accent); color: #1a1405;
  border: none; border-radius: 7px; font-weight: 600; cursor: pointer;
}
.card .run-btn:hover { background: var(--accent-2); }
.card .run-btn:disabled { background: var(--bg-3); color: var(--text-mute); cursor: not-allowed; }

/* ===== 面板/表单 ===== */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.panel h3 { font-size: 15px; margin-bottom: 4px; }
.panel .hint { color: var(--text-dim); font-size: 12px; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border-hi); border-radius: 7px; outline: none;
}
.field textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.btn {
  padding: 9px 16px; border-radius: 7px; border: 1px solid var(--border-hi);
  background: var(--bg-3); color: var(--text); cursor: pointer; transition: .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #1a1405; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: rgba(248,81,73,.1); color: var(--red); border-color: rgba(248,81,73,.3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.token-box {
  background: var(--bg-3); border: 1px dashed var(--border-hi);
  border-radius: 7px; padding: 10px 12px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  color: var(--cyan); word-break: break-all;
}

/* ===== 账号表 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-mute); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: var(--bg-3); }
.badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.badge.ok { background: rgba(63,185,80,.15); color: var(--green); }
.badge.bad { background: rgba(248,81,73,.15); color: var(--red); }
.badge.warn { background: rgba(240,180,41,.15); color: var(--accent); }

/* ===== 日志终端 ===== */
.terminal-panel {
  border-top: 1px solid var(--border); flex: 0 0 auto;
  background: #0a0d12;
}
.terminal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.terminal-head .title { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.terminal-head .job-name { color: var(--accent); }
.terminal-head .spacer { flex: 1; }
.terminal {
  height: 240px; overflow-y: auto; padding: 12px 16px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px; line-height: 1.55; color: #c9d1d9;
}
.log-line { white-space: pre-wrap; word-break: break-all; }
.log-line .ts { color: #484f58; margin-right: 8px; }
.log-line.out { color: #c9d1d9; }
.log-line.info { color: var(--blue); }
.log-line.warn { color: var(--accent); }
.log-line.error { color: var(--red); }
.log-line.input { color: var(--purple); }
.terminal-input {
  display: flex; gap: 8px; padding: 8px 16px;
  border-top: 1px solid var(--border); background: var(--bg-2);
}
.terminal-input input {
  flex: 1; padding: 8px 12px; background: var(--bg-3);
  color: var(--text); border: 1px solid var(--border-hi);
  border-radius: 6px; outline: none; font-family: ui-monospace, monospace; font-size: 12px;
}
.terminal-input input:focus { border-color: var(--accent); }

/* ===== 任务运行列表 ===== */
.job-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; background: var(--panel);
}
.job-item .jname { font-weight: 600; }
.job-item .jmeta { color: var(--text-mute); font-size: 12px; }
.job-item .spacer { flex: 1; }
.st { padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.st.running { background: rgba(88,166,255,.15); color: var(--blue); }
.st.done { background: rgba(63,185,80,.15); color: var(--green); }
.st.failed { background: rgba(248,81,73,.15); color: var(--red); }
.st.stopped { background: rgba(240,180,41,.15); color: var(--accent); }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-mask.hidden { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--border-hi);
  border-radius: 12px; width: 440px; max-width: 92vw;
  padding: 22px; box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 4px; }
.modal .hint { color: var(--text-dim); font-size: 12px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* toast */
.toast {
  position: fixed; top: 70px; right: 20px; z-index: 100;
  background: var(--bg-3); border: 1px solid var(--border-hi);
  border-left: 3px solid var(--accent);
  padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow);
  font-size: 13px; max-width: 360px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

.empty { color: var(--text-mute); text-align: center; padding: 40px; font-size: 13px; }

@media (max-width: 720px) {
  .sidebar { width: 64px; flex-basis: 64px; padding: 12px 6px; }
  .sidebar .nav-title, .nav-item .label { display: none; }
  .nav-item { justify-content: center; }
  .view { padding: 16px; }
}
