/* DuP 云群管 —— 一套纸色 + 石青的控制台样式。无外部依赖。 */

:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --panel: #ffffff;
  --ink: #0f1b2d;
  --faint: #5b6b82;
  --line: #dde5f2;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0ff;
  --ok: #0f7b46;
  --ok-soft: #e6f6ee;
  --warn: #9a6500;
  --warn-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --muted-soft: #eef2f7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.06), 0 8px 28px rgba(15, 27, 45, 0.05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

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

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
small, .small { font-size: 13px; }
.muted { color: var(--faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt0 { margin-top: 0; }
.mt1 { margin-top: 8px; }
.mt2 { margin-top: 16px; }
.mt3 { margin-top: 24px; }
.mb0 { margin-bottom: 0; }
.mb2 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand .mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 800;
}
.brand .sub { color: var(--faint); font-weight: 500; font-size: 14px; }
.topbar nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topbar nav a, .topbar nav button.link {
  padding: 6px 10px; border-radius: 8px; color: var(--ink); font-size: 14px;
}
.topbar nav a:hover { background: var(--accent-soft); text-decoration: none; }
.topbar .who { color: var(--faint); font-size: 13px; padding: 0 6px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
form.inline { display: inline; }

/* ---------- 布局 ---------- */
.wrap { width: min(1180px, 100% - 32px); margin: 0 auto; padding: 28px 0 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .lead { color: var(--faint); margin: 4px 0 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.6fr) minmax(280px, .9fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

/* ---------- 卡片 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.tight { padding: 16px; }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { color: var(--faint); font-size: 13px; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat .lab { color: var(--faint); font-size: 13px; }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .9fr); gap: 28px; align-items: center; padding: 36px 0 12px; }
.hero h1 { font-size: clamp(28px, 4vw, 42px); margin-bottom: 12px; }
.hero .lead { font-size: 17px; color: var(--faint); max-width: 640px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hero-card { background: linear-gradient(150deg, #1d4ed8, #2563eb 45%, #3b82f6); color: #fff; border-radius: 20px; padding: 26px; box-shadow: 0 18px 50px rgba(37, 99, 235, .28); }
.hero-card h3 { color: #fff; }
.hero-card .price { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.hero-card .price small { font-size: 14px; font-weight: 500; opacity: .82; }
.hero-card ul { margin: 14px 0 0; padding-left: 18px; opacity: .95; }
.hero-card li { margin: 6px 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { filter: brightness(1.04); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 徽标 ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--muted-soft); color: var(--faint); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--faint); font-weight: 600; font-size: 12.5px; text-transform: none; background: #fafcff; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .mono { font-size: 13px; }
td.actions { white-space: nowrap; }
td.actions form { display: inline-block; margin-left: 4px; }

/* ---------- 表单 ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
label .hint { font-weight: 400; color: var(--faint); font-size: 12.5px; margin-left: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; line-height: 1.45;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 99, 235, .25); border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
textarea.code { font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.field { margin-bottom: 16px; }
.field .help { color: var(--faint); font-size: 12.5px; margin-top: 5px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; }
.check input { width: 17px; height: 17px; margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 18px; }
legend { padding: 0 8px; font-weight: 700; font-size: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

/* ---------- 提示 ---------- */
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; font-size: 14px; }
.alert.ok { background: var(--ok-soft); border-color: #bfe7d2; color: var(--ok); }
.alert.error { background: var(--danger-soft); border-color: #f6cfca; color: var(--danger); }
.alert.info { background: var(--accent-soft); border-color: #cadcff; color: #1d4ed8; }
.alert.warn { background: var(--warn-soft); border-color: #f0dfae; color: var(--warn); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--faint); }
.empty h3 { color: var(--ink); }
.empty .btn { margin-top: 10px; }

/* ---------- 机器人卡 ---------- */
.bot-card { display: flex; flex-direction: column; gap: 12px; }
.bot-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bot-name { font-weight: 700; font-size: 17px; }
.bot-meta { color: var(--faint); font-size: 13px; }
.bot-stats { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 4px; }
.bot-stats .stat .num { font-size: 19px; }

/* ---------- 日志 ---------- */
.logbox { background: #0b1220; color: #d7e2f4; border-radius: 12px; padding: 14px 16px; max-height: 520px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; }
.logline { white-space: pre-wrap; word-break: break-word; }
.logline .t { color: #7d8ba3; }
.logline .lv { display: inline-block; min-width: 52px; font-weight: 700; }
.logline .lv.INFO { color: #7cc4ff; }
.logline .lv.WARNING { color: #ffd166; }
.logline .lv.ERROR, .logline .lv.CRITICAL { color: #ff7b72; }
.logline .lv.DEBUG { color: #8b98ad; }
.logline .src { color: #8b98ad; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--faint); border-bottom: 2px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- 代码块 ---------- */
pre.code { background: #0b1220; color: #d7e2f4; border-radius: 12px; padding: 14px 16px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; }
code { font-family: var(--mono); font-size: .92em; background: var(--muted-soft); padding: 1px 5px; border-radius: 5px; }

/* ---------- 页脚 ---------- */
footer { border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; padding: 22px 0 40px; }
footer .wrap { padding: 0 0 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4, .grid.side, .hero { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .topbar nav { width: 100%; }
  .wrap { width: min(1180px, 100% - 24px); padding-top: 20px; }
}
@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .card { padding: 16px; }
  th, td { padding: 8px 9px; }
  .stat .num { font-size: 22px; }
}
