/* =============================================================================
   mini-yunlong 管理后台样式
   纯手写 CSS，不引入任何前端框架。
   ========================================================================== */

:root {
  --bg: #0b0f14;
  --bg-elevated: #111823;
  --bg-input: #0d141d;
  --border: #1e2a38;
  --border-strong: #2b3b4e;
  --text: #e6edf5;
  --text-dim: #8b9bb0;
  --text-faint: #5f7086;
  --accent: #4d8dff;
  --accent-strong: #2f6fe0;
  --ok: #2ecc8f;
  --warn: #f0b429;
  --danger: #ef4d5a;
  --radius: 10px;
  --radius-sm: 7px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
}

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

code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ------------------------------------------------------------------ 布局 */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 56px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #7b5cff);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.brand-sub { color: var(--text-faint); font-weight: 400; font-size: 12px; }

.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
}
.nav a:hover { background: #171f2b; color: var(--text); text-decoration: none; }
.nav a.active { background: #1a2534; color: var(--text); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.page { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 13px; }

/* ------------------------------------------------------------------ 卡片 */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.card h2 .hint { font-weight: 400; color: var(--text-faint); font-size: 12px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
}

/* ------------------------------------------------------------------ 指标 */

.stat { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { color: var(--text-faint); font-size: 12px; margin-bottom: 6px; }
.stat-value { font-size: 19px; font-weight: 600; word-break: break-all; }
.stat-value.mono { font-size: 15px; }
.stat-note { color: var(--text-faint); font-size: 11.5px; margin-top: 4px; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv-key { color: var(--text-dim); font-size: 13px; }
.kv-value { font-family: var(--mono); font-size: 12.5px; text-align: right; word-break: break-all; }

/* ------------------------------------------------------------------ 表单 */

label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }

input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-faint); font-family: var(--sans); }

.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row .field { flex: 1; margin-bottom: 0; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--accent-strong); text-decoration: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost, .btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--text-dim); }
button.ghost:hover { background: #171f2b; color: var(--text); }
button.small, .btn.small { padding: 5px 10px; font-size: 12px; }

.hint-text { color: var(--text-faint); font-size: 12px; margin-top: 6px; }

/* ------------------------------------------------------------------ 状态 */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.ok { background: rgba(46, 204, 143, 0.12); color: var(--ok); border-color: rgba(46, 204, 143, 0.3); }
.badge.warn { background: rgba(240, 180, 41, 0.12); color: var(--warn); border-color: rgba(240, 180, 41, 0.3); }
.badge.danger { background: rgba(239, 77, 90, 0.12); color: var(--danger); border-color: rgba(239, 77, 90, 0.3); }
.badge.dim { background: #182130; color: var(--text-dim); border-color: var(--border); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------ 表格 */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #0f1620; color: var(--text-dim); font-weight: 500; font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #131b26; }
td.mono, th.mono { font-family: var(--mono); }
.empty { padding: 28px; text-align: center; color: var(--text-faint); }

/* ------------------------------------------------------------------ 提示 */

.alert {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  border: 1px solid;
  word-break: break-word;
}
.alert.ok { background: rgba(46, 204, 143, 0.08); border-color: rgba(46, 204, 143, 0.35); color: #9fe8c8; }
.alert.error { background: rgba(239, 77, 90, 0.08); border-color: rgba(239, 77, 90, 0.35); color: #f6aeb5; }
.alert.warn { background: rgba(240, 180, 41, 0.08); border-color: rgba(240, 180, 41, 0.35); color: #f3d795; }
.alert.info { background: rgba(77, 141, 255, 0.08); border-color: rgba(77, 141, 255, 0.3); color: #b7d0ff; }
.alert code { background: rgba(255, 255, 255, 0.06); padding: 1px 5px; border-radius: 4px; }
.alert a { color: inherit; text-decoration: underline; }
.hidden { display: none !important; }

/* --------------------------------------------------------------- 登录页 */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}
.login-card .brand { justify-content: center; margin-bottom: 6px; font-size: 16px; }
.login-title { text-align: center; color: var(--text-dim); font-size: 13px; margin: 0 0 22px; }
.login-card button { width: 100%; margin-top: 6px; }

/* ------------------------------------------------------------------ 其他 */

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 12px; }
.tag {
  font-family: var(--mono);
  font-size: 11.5px;
  background: #182130;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--text-dim);
}
.copy-line {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.copy-line .value { flex: 1; font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
