:root {
  --bg: #f4f7f9;
  --panel: #fff;
  --panel-soft: #f8fafb;
  --line: #dce5ea;
  --line-strong: #b9c9d2;
  --text: #173042;
  --muted: #6b7d88;
  --blue: #1769aa;
  --blue-hover: #0f568e;
  --cyan: #13a8b5;
  --ok: #16845b;
  --warn: #9a6900;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(25, 55, 75, .08);
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at 12% 15%, rgba(19, 168, 181, .12), transparent 30%), linear-gradient(135deg, #edf5f7 0%, #f7f9fa 58%, #eaf1f5 100%);
}
.login-panel {
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(360px, 1fr);
  width: min(820px, 100%);
  min-height: 500px;
  overflow: hidden;
  border: 1px solid rgba(185, 201, 210, .8);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.login-aside {
  display: flex;
  flex-direction: column;
  padding: 42px 38px;
  color: #fff;
  background: linear-gradient(145deg, #123b56, #176b82 62%, #13a8b5);
}
.login-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 58px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
}
.login-kicker, .login-eyebrow { margin: 0 0 10px; color: var(--cyan); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; }
.login-aside .login-kicker { color: #9de9e8; }
.login-aside h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.login-aside-copy { max-width: 220px; margin: 14px 0 0; color: rgba(255,255,255,.72); line-height: 1.8; }
.login-aside-foot { margin-top: auto; color: rgba(255,255,255,.78); font-size: 12px; }
.online-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #78e3b1; box-shadow: 0 0 0 4px rgba(120,227,177,.14); }
.login-card { padding: 56px 52px 38px; }
.login-card h2 { margin: 0; color: var(--text); font-size: 25px; letter-spacing: 0; }
.login-subtitle { margin: 8px 0 30px; color: var(--muted); font-size: 13px; }
.login-security-note { margin: 24px 0 0; color: var(--muted); font-size: 12px; }
.login-security-note span { color: var(--ok); font-weight: 700; }
.muted { color: var(--muted); margin: 6px 0 0; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: #444; }
.field input, textarea.mono, input[type="number"], input[type="text"], input[type="password"] {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 7px 8px;
  outline: none;
}
.field input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 105, 170, .1); }
.field input, textarea.mono { border-radius: 7px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s; }
.captcha-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px 116px; align-items: center; gap: 7px; }
.captcha-image { display: block; width: 116px; height: 42px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; object-fit: cover; }
.captcha-image.loading { opacity: .45; }
.captcha-refresh { padding: 0; border: 0; color: var(--blue); background: transparent; font-size: 22px; }
.captcha-row input { min-width: 0; text-transform: uppercase; }
textarea.mono, .mono { font-family: var(--mono); font-size: 13px; line-height: 1.5; }
textarea.mono { width: 100%; resize: vertical; }

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  border-radius: 7px;
  padding: 8px 14px;
  line-height: 1.4;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 5px 14px rgba(23, 105, 170, .18); }
.btn-primary:hover { box-shadow: 0 7px 18px rgba(23, 105, 170, .25); }
.btn:hover { background: #f6f7f8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: #fff; }
.btn-ghost { background: #fff; }
.btn-danger {
  background: #fff;
  border-color: #e3b4b0;
  color: var(--danger);
}
.btn-danger:hover { background: #fdf4f3; }
.err { color: var(--danger); font-size: 13px; margin: 8px 0 0; }

.app {
  display: grid;
  grid-template-columns: 224px 1fr;
  min-height: 100vh;
  background: #f4f7f9;
}
.sidebar {
  background: #123b56;
  border-right: 1px solid #0d3047;
  display: flex;
  flex-direction: column;
  padding: 0;
  color: #dceaf0;
}
.side-brand {
  padding: 22px 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.side-link {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--blue);
  text-decoration: none;
}
.side-link:hover { text-decoration: underline; }
.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; flex: 1; }
.nav-item {
  text-align: left;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: #c1d2dc;
  border-radius: 7px;
  padding: 11px 13px 11px 10px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: rgba(19,168,181,.18);
  border-left-color: #43d0d1;
  color: #fff;
  font-weight: 600;
}
.side-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.12); }
.side-foot .muted { margin: 0 0 8px; color: #aac0cd; font-size: 12px; }
.side-foot .btn { border-color: rgba(255,255,255,.22); background: transparent; color: #fff; }
.side-foot .btn:hover { background: rgba(255,255,255,.09); }

.main { min-width: 0; padding: 24px 28px 36px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: 0; }
.topbar .muted { margin-top: 5px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid #c9e2d0;
  background: #f3faf5;
  font-size: 12px;
  color: var(--ok);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(25, 55, 75, .025);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.badge {
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  background: #f6f7f8;
  color: #444;
}
.badge.warn { color: var(--warn); border-color: #ead7a6; background: #fffaf0; }
.badge.ok { color: var(--ok); border-color: #c9e2d0; background: #f3faf5; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.stat { margin-bottom: 0; }
.stat strong {
  display: block;
  font-size: 22px;
  font-weight: 600;
  margin: 4px 0;
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-hint { font-size: 12px; color: #888; }

.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; align-items: start; }
.grid-2 > .card, .stack > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}
.checklist li:last-child { border-bottom: 0; }
.tag { font-size: 12px; }
.tag.on { color: var(--ok); }
.tag.off { color: var(--danger); }

.tip { font-size: 12px; margin: 10px 0 0; line-height: 1.6; }

.csv-guide {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #f7f8f9;
  font-size: 12px;
  line-height: 1.6;
}
.csv-guide p { margin: 0 0 6px; }
.csv-guide p:last-child { margin-bottom: 0; color: var(--muted); }
.csv-guide-copy { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.csv-amount-field { margin: 10px 0; max-width: 260px; }
.csv-amount-field input { width: 100%; }
.csv-guide code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
#csv-copy-status { color: var(--ok); }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  text-align: left;
  padding: 8px 8px;
  border-bottom: 1px solid #eee;
}
.table th {
  color: #555;
  font-weight: 600;
  background: #f7f8f9;
  border-bottom: 1px solid var(--line);
}
.table tbody tr:hover { background: #fafbfc; }
.status { font-size: 12px; }
.status.running { color: var(--blue); }
.status.done { color: var(--ok); }
.status.failed, .status.stopped { color: var(--danger); }
.status.queued { color: var(--warn); }

.transfer-hero { padding: 10px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-btn {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 7px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.mode-btn .mode-title { display: block; font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.mode-btn .mode-desc { font-size: 12px; }
.mode-btn.active {
  border-color: var(--blue);
  background: #f4f8fc;
  color: var(--muted);
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field-grid .full { grid-column: 1 / -1; }
.toggles { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #333;
}
.switch input { accent-color: var(--blue); width: 14px; height: 14px; }

.warn-card {
  border-color: #ead7a6;
  background: #fffaf0;
}
.warn-card strong { display: block; margin-bottom: 4px; font-weight: 600; color: #5c4300; }
.warn-card p { margin: 0; color: #555; font-size: 13px; line-height: 1.55; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions-row.tight { margin: 4px 0 12px; }
.jobs-actions { margin: 0 0 10px; }
.select-all-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.job-select, #jobs-select-all, #jobs-select-all-header { width: 15px; height: 15px; vertical-align: middle; }
#tg-status-list { margin-bottom: 8px; }

.log-pane {
  margin: 0;
  padding: 10px 12px;
  max-height: 360px;
  overflow: auto;
  background: #f7f8f9;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
  font-size: 12px;
}

.modal {
  border: 1px solid var(--line-strong);
  padding: 0;
  background: #fff;
  color: var(--text);
  width: min(720px, 92vw);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.35); }
.modal-inner { padding: 16px; margin: 0; }
.modal-inner h3 { margin: 0 0 10px; font-size: 15px; }

[hidden] { display: none !important; }

.linkish {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  color: var(--blue);
  font: inherit;
  cursor: pointer;
}
#tg-need-banner { margin-bottom: 12px; }

.table-wrap { border: 1px solid var(--line); border-radius: 7px; }
.table th, .table td { padding: 10px 12px; white-space: nowrap; }
.table th { color: var(--muted); font-size: 12px; }
.table tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }

.stat { position: relative; overflow: hidden; }
.stat strong { color: var(--text); font-variant-numeric: tabular-nums; }
.stat:nth-child(1) { border-top: 3px solid var(--blue); }
.stat:nth-child(2) { border-top: 3px solid var(--ok); }
.stat:nth-child(3) { border-top: 3px solid var(--danger); }
.stat:nth-child(4) { border-top: 3px solid var(--cyan); }
.stat-hint { display: block; margin-top: 5px; color: var(--muted); }

.card-head { padding-bottom: 9px; border-bottom: 1px solid #edf1f3; }
.field > span { color: var(--text); font-weight: 600; }
input[type="checkbox"] { accent-color: var(--blue); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(19, 168, 181, .3);
  outline-offset: 2px;
}
.mode-btn.active { box-shadow: inset 0 0 0 1px var(--blue), 0 2px 7px rgba(23, 105, 170, .08); }
.pill { border-radius: 999px; }
.badge { border-radius: 4px; }
.log-pane { border-radius: 7px; }
.modal { border-radius: 8px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { border-left: 0; border-bottom: 2px solid transparent; }
  .nav-item.active { border-bottom-color: #43d0d1; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 20px 22px 30px; }
}

@media (max-width: 600px) {
  .login-wrap { padding: 14px; }
  .login-panel { grid-template-columns: 1fr; min-height: 0; }
  .login-aside { padding: 22px 24px; }
  .login-mark { width: 40px; height: 40px; margin-bottom: 22px; }
  .login-aside h1 { font-size: 24px; }
  .login-aside-copy { margin-top: 8px; }
  .login-aside-foot { margin-top: 20px; }
  .login-card { padding: 28px 24px; }
  .login-subtitle { margin-bottom: 22px; }
  .captcha-row { grid-template-columns: minmax(0, 1fr) 28px 96px; }
  .captcha-image { width: 96px; height: 40px; }
  .app { display: block; }
  .side-brand { padding: 14px 16px; }
  .side-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; }
  .nav-item { padding: 9px 10px; }
  .side-foot { padding: 10px 12px; }
  .main { padding: 16px 12px 24px; }
  .topbar { align-items: flex-start; gap: 10px; }
  .topbar h2 { font-size: 18px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .stat-grid, .field-grid, .mode-switch { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .table th, .table td { padding: 9px 10px; }
}
