/* AI Agent 授权中心 — 管理后台样式 */
:root {
  --bg: #f5f6f8;
  --panel: #fff;
  --line: #e3e6eb;
  --text: #24303f;
  --dim: #7b8794;
  --brand: #2f6fed;
  --brand-dark: #2559c4;
  --ok: #1f9d55;
  --warn: #d9822b;
  --err: #d64545;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, Arial, sans-serif;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶部导航 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: #1f2b3a;
  color: #fff;
}
.topbar .brand { font-size: 16px; font-weight: 600; letter-spacing: .5px; }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a {
  padding: 6px 14px;
  border-radius: 6px;
  color: #c8d2de;
  font-size: 14px;
}
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topbar nav a.active { background: var(--brand); color: #fff; }
.topbar nav a.quit { color: #f0b4b4; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }

h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 12px; }

/* 提示条 */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert.ok { background: #e8f7ee; color: #17683a; border: 1px solid #b8e3c9; }
.alert.err { background: #fdeded; color: #962a2a; border: 1px solid #f3c2c2; }

/* 卡片与面板 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}
.card .num { font-size: 26px; font-weight: 600; color: var(--brand); }
.card .lbl { color: var(--dim); font-size: 13px; margin-top: 2px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
}
.panel h2 { margin-top: 0; }
.panel.highlight { border-color: #bcd0f7; background: #f4f8ff; }

.keys {
  background: #1f2b3a;
  color: #d8e4f5;
  border-radius: 8px;
  padding: 14px;
  font-family: Consolas, Monaco, monospace;
  font-size: 14px;
  letter-spacing: 1px;
  line-height: 1.9;
  white-space: pre;
  overflow-x: auto;
  margin: 0 0 12px;
}

/* 表单 */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--dim); }
.field.grow { flex: 1; min-width: 200px; }

input, select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }

.row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.row-form .field { margin-bottom: 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 18px; align-items: start; }
.grid-form button { grid-column: 1 / -1; justify-self: start; margin-top: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--err); border-color: #eebdbd; }
.btn.danger:hover { background: #fdeded; border-color: var(--err); color: var(--err); }
.btn.ghost { background: transparent; color: var(--dim); }
.btn.tiny { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--dim); font-weight: 500; background: #fafbfc; white-space: nowrap; }
.tbl tr:hover td { background: #fafcff; }

.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th { width: 140px; padding: 9px 10px; text-align: left; color: var(--dim); font-weight: 500; border-bottom: 1px solid var(--line); }
.kv td { padding: 9px 10px; border-bottom: 1px solid var(--line); }

.mono { font-family: Consolas, Monaco, monospace; letter-spacing: .5px; }
.dim { color: var(--dim); }
.strong { font-weight: 600; }
.empty { color: var(--dim); padding: 16px 0; text-align: center; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.tag.on { background: #e8f7ee; color: #17683a; }
.tag.off { background: #f1f2f4; color: #6b7280; }
.tag.warn { background: #fdf3e5; color: #9a5c11; }
.tag.idle { background: #eaf1ff; color: #2559c4; }

.ops { display: flex; gap: 6px; flex-wrap: wrap; }
.ops form { margin: 0; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.actions form { margin: 0; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.back { font-size: 13px; }

/* 登录页 */
.login-card {
  max-width: 380px;
  margin: 8vh auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(31,43,58,.06);
}
.login-card h1 { font-size: 18px; text-align: center; margin-bottom: 20px; }
.login-card .field input { height: 40px; }

/* 滑块拼图验证码 */
.cap { width: 300px; user-select: none; }
.cap-frame {
  position: relative;
  width: 300px;
  height: 150px;
  border-radius: 8px;
  overflow: hidden;
  background: #dfe4ea;
  touch-action: none;
}
.cap-frame img { position: absolute; display: block; }
.cap-bg { inset: 0; width: 100%; height: 100%; }
.cap-piece { top: 0; left: 0; }
.cap-bar {
  position: relative;
  height: 40px;
  margin-top: 10px;
  border-radius: 6px;
  background: #eef1f5;
  border: 1px solid var(--line);
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}
.cap-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #dce8ff; }
.cap-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  color: var(--brand);
  font-size: 20px;
  transition: none;
}
.cap-bar.dragging .cap-handle { background: var(--brand); color: #fff; border-color: var(--brand); }
.cap-tip {
  position: absolute;
  left: 50px;
  right: 12px;
  top: 0;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-size: 13px;
  pointer-events: none;
}
.cap-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.cap-state { color: var(--dim); font-size: 12px; }
.cap-refresh { font-size: 12px; }
