/* 阿爪智能体 · 管理后台样式 */
:root {
  --primary: #5b6cff;
  --primary-dark: #4453e0;
  --primary-soft: #eef0ff;
  --danger: #e5484d;
  --ok: #30a46c;
  --bg: #f4f5f9;
  --card: #fff;
  --text: #1a1d29;
  --text-sub: #6b7280;
  --text-weak: #9aa1b1;
  --line: #e8eaf1;
  --radius: 12px;
  --shadow: 0 1px 8px rgba(20, 26, 60, .05);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
input, select, textarea, button { font-family: inherit; font-size: 14px; }

/* 登录 */
.login-mask {
  position: fixed; inset: 0; background: linear-gradient(135deg, #5b6cff, #7b5bff);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.login-box {
  background: #fff; border-radius: 16px; padding: 32px; width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.lb-title { font-size: 20px; font-weight: 600; text-align: center; }
.lb-sub { text-align: center; color: var(--text-weak); font-size: 13px; margin-bottom: 22px; }
.login-box input {
  width: 100%; padding: 11px 13px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 9px; outline: none;
}
.login-box input:focus { border-color: var(--primary); }
.lb-tip { text-align: center; font-size: 12px; color: var(--text-weak); margin-top: 12px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.sb-brand { font-size: 15px; font-weight: 600; padding: 4px 8px 18px; }
.sb-nav { flex: 1; }
.sb-item {
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  color: var(--text-sub); margin-bottom: 2px;
}
.sb-item:hover { background: var(--bg); }
.sb-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 500; }
.sb-foot { padding-top: 12px; border-top: 1px solid var(--line); }
.sb-link { color: var(--text-weak); font-size: 13px; display: block; padding: 4px 8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-top {
  background: #fff; border-bottom: 1px solid var(--line); padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.m-top h1 { margin: 0; font-size: 18px; font-weight: 600; }
.mt-right { color: var(--text-weak); font-size: 13px; }
.m-content { padding: 20px 24px 60px; flex: 1; }

/* 组件 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; cursor: pointer; font-weight: 500;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.tiny { padding: 5px 11px; font-size: 13px; border-radius: 7px; }

.panel {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.p-head { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.p-tip { font-size: 12px; color: var(--text-weak); line-height: 1.7; margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.sc-label { font-size: 12px; color: var(--text-weak); }
.sc-num { font-size: 24px; font-weight: 700; margin: 4px 0 2px; }
.sc-sub { font-size: 11px; color: var(--text-weak); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; color: var(--text-weak); font-weight: 500;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid #f3f4f8; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.td-sub { font-size: 11px; color: var(--text-weak); margin-top: 2px; }
.tbl code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.tbl code.mini { font-size: 11px; color: var(--text-sub); }
.plus { color: var(--ok); }
.minus { color: var(--text); }

.num { width: 72px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; outline: none; text-align: center; }
.num:focus { border-color: var(--primary); }
.cost-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 10px; }
.cost-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-sub); }
.cost-row input:not(.num) { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; }
.cost-row input:focus { border-color: var(--primary); }
.search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.search-row input, .search-row select {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; min-width: 180px;
}
.search-row input:focus, .search-row select:focus { border-color: var(--primary); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: #d4d7e2; border-radius: 22px;
  cursor: pointer; transition: .2s;
}
.switch span::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }

.sel-model { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #fff; }
.badge { padding: 2px 8px; border-radius: 5px; font-size: 12px; }
.badge.ok { background: #e7f6ee; color: var(--ok); }
.badge.bad { background: #fdecec; color: var(--danger); }
.pager { padding-top: 12px; font-size: 13px; color: var(--text-weak); }
.code-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-family: Consolas, monospace; font-size: 13px;
  white-space: pre-wrap; margin-top: 12px; max-height: 240px; overflow: auto;
}
.empty { text-align: center; padding: 24px; color: var(--text-weak); }
.loading-tip { padding: 24px; text-align: center; color: var(--text-weak); }
.hint { font-size: 12px; color: var(--text-weak); }

.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: rgba(26,29,41,.93); color: #fff; padding: 10px 20px;
  border-radius: 9px; font-size: 14px; z-index: 200;
}
.loading-mask {
  position: fixed; inset: 0; background: rgba(255,255,255,.45); z-index: 150;
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--line);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .sb-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .m-content { padding: 14px; }
  .tbl { font-size: 12px; }
}
