/* DeepSeek 控制台 — 样式
   深色为默认，跟随系统浅色。纯 CSS 变量驱动，无外部依赖。 */

:root {
  --bg: #0a0e14;
  --sidebar: #0d1219;
  --surface: #121924;
  --surface-2: #182130;
  --surface-3: #1f2937;
  --border: #222d3d;
  --border-strong: #2e3b4e;
  --text: #e8eef7;
  --text-dim: #9aa8bb;
  --muted: #6b7a8f;
  --accent: #3b8cff;
  --accent-soft: rgba(59, 140, 255, 0.14);
  --ok: #35d399;
  --ok-soft: rgba(53, 211, 153, 0.13);
  --warn: #f5b544;
  --bad: #f4667a;
  --bad-soft: rgba(244, 102, 122, 0.13);
  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.22);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa;
    --sidebar: #ffffff;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eef2f7;
    --border: #e2e8f0;
    --border-strong: #cdd7e3;
    --text: #0f1720;
    --text-dim: #4b5768;
    --muted: #7a8698;
    --accent: #1f6fe0;
    --accent-soft: rgba(31, 111, 224, 0.1);
    --ok: #0f9d69;
    --ok-soft: rgba(15, 157, 105, 0.11);
    --warn: #b7791f;
    --bad: #d63a54;
    --bad-soft: rgba(214, 58, 84, 0.1);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.08);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

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

button, input, textarea, select { font: inherit; color: inherit; }

/* ─────────── 登录 ─────────── */

.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 50% -12%, var(--accent-soft), transparent 62%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px 28px 26px;
  box-shadow: var(--shadow);
}

.login-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), #7a5cff);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; color: #fff;
  margin-bottom: 16px;
}

.login-card h1 { font-size: 19px; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-card p.sub { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; }

/* ─────────── 布局 ─────────── */

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), #7a5cff);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex: none;
}
.brand-text { min-width: 0; }
.brand-name { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  border: 0; background: none;
  text-align: left; width: 100%;
  font-size: 13.5px;
  transition: background 0.13s ease, color 0.13s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[data-active="true"] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-icon { width: 17px; text-align: center; opacity: 0.9; flex: none; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar-note { font-size: 11px; color: var(--muted); padding: 0 6px; line-height: 1.5; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.topbar h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.topbar .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.view { padding: 22px 26px 48px; display: flex; flex-direction: column; gap: 18px; }

/* ─────────── 组件 ─────────── */

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.13s ease, background 0.13s ease, opacity 0.13s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.42; cursor: default; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 46%, var(--border-strong)); }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn.tiny { padding: 4px 9px; font-size: 12px; border-radius: 7px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: 0.02em; }
.card-head .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 17px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 17px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent); opacity: 0.85;
}
.stat[data-tone="ok"]::after { background: var(--ok); }
.stat[data-tone="warn"]::after { background: var(--warn); }
.stat-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; }
.stat-value { font-size: 27px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: 13px; font-weight: 500; color: var(--text-dim); margin-left: 5px; }
.stat-foot { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 10px 17px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 17px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.mono { font-family: var(--mono); font-size: 12.5px; }

.key-name { font-weight: 600; }
.key-note { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge[data-tone="ok"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: var(--ok-soft); }
.badge[data-tone="bad"] { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: var(--bad-soft); }
.badge[data-tone="warn"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.input, .textarea {
  width: 100%; padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.13s ease;
}
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 128px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

.toggle {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
}
.toggle input { display: none; }
.toggle .track {
  width: 38px; height: 22px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  position: relative; transition: background 0.15s ease, border-color 0.15s ease; flex: none;
}
.toggle .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-dim); transition: transform 0.15s ease, background 0.15s ease;
}
.toggle input:checked + .track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); background: #fff; }

.code-block {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  overflow-x: auto; white-space: pre;
  color: var(--text-dim);
}

.note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.6;
}
.note[data-tone="bad"] { border-color: color-mix(in srgb, var(--bad) 42%, transparent); color: var(--bad); background: var(--bad-soft); }
.note[data-tone="ok"] { border-color: color-mix(in srgb, var(--ok) 42%, transparent); color: var(--ok); background: var(--ok-soft); }
.note[data-tone="warn"] { border-color: color-mix(in srgb, var(--warn) 42%, transparent); color: var(--warn); }

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 13px; max-width: 380px;
  animation: toast-in 0.18s ease;
}
.toast[data-tone="ok"] { border-left-color: var(--ok); }
.toast[data-tone="bad"] { border-left-color: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(4, 8, 14, 0.62);
  display: grid; place-items: center; padding: 24px;
  backdrop-filter: blur(3px);
}
.modal {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.modal h3 { margin: 0 0 4px; font-size: 15px; }
.modal .sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 14px; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  display: inline-block; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; align-items: center; gap: 14px;
    overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .sidebar-foot { margin-top: 0; flex-direction: row; align-items: center; }
  .sidebar-note { display: none; }
  .nav { flex-direction: row; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
