/* BOSS 后台样式。手写，不引任何框架：这一份 CSS 就是全部前端资产。
   设计取向：浅色、留白足、边框轻，表格与数字要好扫。 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f7f8fa;
  --card: #fff;
  --border: #e6e8ee;
  --border-strong: #d5d9e2;
  --text: #14161c;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --ok: #07835c;
  --ok-soft: #e6f6f0;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --danger: #c02626;
  --danger-soft: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 16px rgba(17, 24, 39, 0.04);
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ============ 侧栏 ============ */

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 4px 10px 18px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: #3f4652;
  font-weight: 500;
}
.sidebar nav a:hover {
  background: #f3f4f8;
  text-decoration: none;
}
.sidebar nav a.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.side-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-foot .ch {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
}
.side-foot .k {
  color: var(--faint);
  flex: 0 0 auto;
}
.side-foot .v {
  color: var(--muted);
  text-align: right;
  word-break: break-all;
}
.side-foot .v.ok {
  color: var(--ok);
}
.side-foot .v.off {
  color: var(--faint);
}

/* ============ 主区 ============ */

.main {
  flex: 1;
  min-width: 0;
  padding: 22px 30px 40px;
  max-width: 1180px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.tnum {
  font-variant-numeric: tabular-nums;
}

/* ============ 卡片 ============ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card-head h2 {
  font-size: 14px;
  font-weight: 620;
  margin: 0;
}

.card-body {
  padding: 18px;
}

.card-body.flush {
  padding: 0;
}

/* ============ 数字块 ============ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px;
}

.stat .k {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.stat .v {
  font-size: 22px;
  font-weight: 660;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat .sub {
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 4px;
}

.stat.warn .v {
  color: var(--warn);
}
.stat.danger .v {
  color: var(--danger);
}
.stat.accent .v {
  color: var(--accent);
}

/* ============ 柱状图 ============ */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 168px;
  padding: 0 2px;
  position: relative;
}

.chart::before {
  content: "";
  position: absolute;
  inset: 0 0 22px;
  background: repeating-linear-gradient(
    to top,
    var(--border) 0 1px,
    transparent 1px 25%
  );
  pointer-events: none;
  opacity: 0.7;
}

.bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  position: relative;
  z-index: 1;
}

.bar {
  width: 100%;
  max-width: 34px;
  background: linear-gradient(180deg, #6d63f2, #4f46e5);
  border-radius: 5px 5px 2px 2px;
  min-height: 2px;
  transition: opacity 0.15s;
}

.bar.zero {
  background: var(--border-strong);
}

.bar-wrap .amt {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar-wrap .lbl {
  font-size: 11px;
  color: var(--faint);
  height: 22px;
  line-height: 22px;
  white-space: nowrap;
}

/* ============ 表格 ============ */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
  background: #fbfbfd;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f2f5;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafbfd;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

/* ============ 徽标 ============ */

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.7;
  white-space: nowrap;
  background: #eef0f4;
  color: #4b5563;
}
.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.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ============ 表单 ============ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 520;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  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 rgba(79, 70, 229, 0.12);
}

textarea {
  resize: vertical;
  min-height: 64px;
}

.hint {
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.5;
}

/* ============ 按钮 ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn:hover {
  background: #4338ca;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.sm {
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: 7px;
}

.btn.ghost {
  background: #fff;
  border-color: var(--border-strong);
  color: #3f4652;
}
.btn.ghost:hover {
  background: #f7f8fa;
  border-color: #c3c8d2;
}

.btn.danger {
  background: #fff;
  border-color: #f0c4c4;
  color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger-soft);
}

.btn.dark {
  background: #1f2430;
}
.btn.dark:hover {
  background: #111827;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* ============ 提示条 ============ */

.flash {
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 16px;
  background: var(--ok-soft);
  border: 1px solid #c6e9db;
  color: var(--ok);
}
.flash.err {
  background: var(--danger-soft);
  border-color: #f3cbcb;
  color: var(--danger);
}

.note {
  padding: 11px 14px;
  border-radius: 9px;
  background: #fbfbfd;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.65;
}
.note.warn {
  background: var(--warn-soft);
  border-color: #f5e0bd;
  color: var(--warn);
}

/* ============ 密钥展示 ============ */

.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.06em;
  background: #14161c;
  color: #e8eaf0;
  border-radius: 10px;
  padding: 14px 16px;
  word-break: break-all;
  user-select: all;
}

/* ============ 登录页 ============ */

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 348px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(17, 24, 39, 0.07);
  padding: 26px 24px;
}

.login-card h1 {
  font-size: 17px;
  margin: 0 0 4px;
  font-weight: 650;
}

.login-card p.sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12.5px;
}

.login-card .field {
  margin-bottom: 13px;
}

.login-card .btn {
  width: 100%;
  margin-top: 6px;
  padding: 9px;
}

/* ============ 两列布局 ============ */

.cols {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 940px) {
  .cols {
    grid-template-columns: 1fr;
  }
  body {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .side-foot {
    display: none;
  }
  .main {
    padding: 18px 16px 32px;
  }
}

.foot {
  margin-top: 26px;
  font-size: 11.5px;
  color: var(--faint);
  text-align: center;
}

dl.kv {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 12px;
  margin: 0;
  font-size: 13px;
}
dl.kv dt {
  color: var(--muted);
}
dl.kv dd {
  margin: 0;
  word-break: break-all;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: #f3f4f8;
  padding: 1px 5px;
  border-radius: 4px;
}
