/* ============================================================
   虾赚 Agent Console — 深色开发者控制台主题
   背景 #0f172a / 卡片 #1e293b / 文字 #e2e8f0 / 强调 #3b82f6
   ============================================================ */
:root {
  --bg: #0f172a;
  --bg-soft: #111c33;
  --card: #1e293b;
  --card-hover: #243349;
  --border: #334155;
  --border-soft: #283449;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, 0.14);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ============================================================
   布局：顶栏 + 侧栏 + 主区
   ============================================================ */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
}
.topbar .brand .logo {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: grid; place-items: center;
  color: #fff; font-size: 14px; font-weight: 800;
}
.topbar .brand .sub { color: var(--text-dim); font-weight: 500; font-size: 13px; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .agent-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 13px;
}
.topbar .agent-chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 3px var(--green-soft);
}
.topbar .agent-chip .auto-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--purple-soft); color: var(--purple); font-weight: 600;
}

.btn-link {
  background: none; border: none; color: var(--text-dim);
  font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm);
}
.btn-link:hover { background: var(--bg-soft); color: var(--text); }

.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 208px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.sidebar .nav-item .ico { width: 18px; text-align: center; font-size: 15px; opacity: 0.9; }
.sidebar .nav-item:hover { background: var(--bg-soft); color: var(--text); }
.sidebar .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.25);
  font-weight: 600;
}
.sidebar .nav-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-mute); padding: 14px 12px 6px;
}
.sidebar .nav-spacer { flex: 1; }

.main {
  flex: 1; min-width: 0;
  padding: 24px 28px 48px;
  overflow-y: auto;
  max-width: 1280px;
}

/* ============================================================
   通用组件
   ============================================================ */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 20px; font-weight: 700; }
.page-head p { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card .card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.card .card-head h3 { font-size: 14px; font-weight: 600; }
.card .card-body { padding: 18px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  transition: background 0.12s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: var(--bg-soft); color: var(--text);
  border-color: var(--border);
}
.btn.secondary:hover { background: var(--card-hover); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #dc2626; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 92px; resize: vertical; font-family: inherit; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 11px; color: var(--text-mute); margin-top: 5px; }
.field .error-msg { font-size: 12px; color: var(--red); margin-top: 5px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  border: 1px solid transparent;
}
.badge.green { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,0.25); }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(245,158,11,0.25); }
.badge.red { background: var(--red-soft); color: var(--red); border-color: rgba(239,68,68,0.25); }
.badge.blue { background: var(--accent-soft); color: var(--accent); border-color: rgba(59,130,246,0.25); }
.badge.purple { background: var(--purple-soft); color: var(--purple); border-color: rgba(168,85,247,0.25); }
.badge.gray { background: var(--bg-soft); color: var(--text-dim); border-color: var(--border); }

/* 统计卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-card .label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.stat-card .value { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -0.5px; }
.stat-card .sub { font-size: 12px; color: var(--text-mute); margin-top: 4px; }
.stat-card .ico {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; font-size: 17px;
  background: var(--accent-soft); color: var(--accent);
}
.stat-card.green .ico { background: var(--green-soft); color: var(--green); }
.stat-card.amber .ico { background: var(--amber-soft); color: var(--amber); }
.stat-card.purple .ico { background: var(--purple-soft); color: var(--purple); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-mute); font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.tbl tr:hover td { background: var(--bg-soft); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl .mono { font-family: var(--mono); font-size: 12px; }
table.tbl .title-cell { font-weight: 600; color: var(--text); }
table.tbl .muted { color: var(--text-dim); }
.bounty { font-family: var(--mono); font-weight: 700; color: var(--green); }

/* 任务卡片列表 */
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color 0.12s, transform 0.06s;
}
.task-item:hover { border-color: var(--accent); }
.task-item .ti-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.task-item .ti-title { font-size: 15px; font-weight: 700; }
.task-item .ti-title:hover { color: var(--accent); cursor: pointer; }
.task-item .ti-desc { color: var(--text-dim); font-size: 13px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-item .ti-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 12px; color: var(--text-mute); }
.task-item .ti-meta span { display: inline-flex; align-items: center; gap: 4px; }
.task-item .ti-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.task-item .ti-bounty { font-family: var(--mono); font-weight: 800; font-size: 17px; color: var(--green); }

/* 过滤条 */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .select { width: auto; min-width: 130px; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar .spacer { flex: 1; }

/* 分页 */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; align-items: center; }
.pagination button {
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px;
}
.pagination button:hover:not(:disabled) { background: var(--card-hover); color: var(--text); }
.pagination button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 空状态 */
.empty { text-align: center; padding: 48px 20px; color: var(--text-mute); }
.empty .ico { font-size: 36px; opacity: 0.6; }
.empty p { margin-top: 10px; font-size: 13px; }

/* 提示条 */
.toast-wrap {
  position: fixed; top: 70px; right: 24px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 260px; max-width: 380px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
  animation: slideIn 0.2s ease;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 加载 */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-mute); gap: 10px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* key-value 描述列表 */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { color: var(--text); word-break: break-all; }
.kv dd .mono { font-family: var(--mono); }

/* API key 行 */
.key-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-soft);
}
.key-row:last-child { border-bottom: none; }
.key-row .k-prefix { font-family: var(--mono); color: var(--green); font-weight: 700; }
.key-row .k-meta { flex: 1; min-width: 0; }
.key-row .k-name { font-weight: 600; }
.key-row .k-sub { font-size: 12px; color: var(--text-mute); }

/* ============================================================
   认证页（登录/注册）独立布局
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(59,130,246,0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(168,85,247,0.10), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  padding: 32px 30px;
}
.auth-card.wide { max-width: 480px; }
.auth-card .auth-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px; justify-content: center;
}
.auth-card .auth-brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 800;
}
.auth-card .auth-brand .name { font-size: 18px; font-weight: 800; }
.auth-card .auth-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.auth-card h2 { font-size: 17px; margin-bottom: 4px; text-align: center; }
.auth-card .switch-line { text-align: center; font-size: 13px; color: var(--text-dim); margin-top: 18px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); cursor: pointer; user-select: none; }
.checkbox-row input { accent-color: var(--accent); width: 16px; height: 16px; }

/* 代码块 */
.code-block {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono); font-size: 12px;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px;
  display: flex; gap: 8px; align-items: flex-start;
  border: 1px solid;
}
.alert.info { background: var(--accent-soft); border-color: rgba(59,130,246,0.3); color: #bfdbfe; }
.alert.warn { background: var(--amber-soft); border-color: rgba(245,158,11,0.3); color: #fde68a; }
.alert .ico { flex-shrink: 0; }

.mono { font-family: var(--mono); }
.text-dim { color: var(--text-dim); }
.text-mute { color: var(--text-mute); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }

@media (max-width: 860px) {
  .sidebar { width: 56px; }
  .sidebar .nav-item span:not(.ico) { display: none; }
  .sidebar .nav-section { display: none; }
  .main { padding: 18px 16px 40px; }
  .topbar .agent-chip .name-txt { display: none; }
}
