:root {
  --bg: #0b0f0f;
  --panel: #121717;
  --panel-2: #171f1f;
  --line: #22302e;
  --text: #d7e0e0;
  --dim: #7f8c8c;
  --accent: #0e9f6e;
  --accent-2: #2fd08e;
  --warn: #d98b3a;
  --danger: #d9534f;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: min(380px, 94vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 26px;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 19px;
  letter-spacing: .3px;
}
.login-card p { margin: 0 0 20px; color: var(--dim); font-size: 12.5px; }

/* ---------- 框架 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: #0e1313;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}
.brand-badge {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #0b7a55);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--dim); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
}
.nav-item:hover { background: #1a2222; text-decoration: none; }
.nav-item.active { background: #123329; color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--dim); }
.nav-item.active .dot { background: var(--accent-2); }
.sidebar .spacer { flex: 1; }
.sidebar-foot { font-size: 11px; color: var(--dim); padding: 10px; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; padding: 24px 28px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.page-head .hint { color: var(--dim); font-size: 12.5px; }

/* ---------- 卡片 / 统计 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
/* 概览页 8 张卡：固定 4 列，避免最后一张单独掉到第二行 */
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { color: var(--dim); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; letter-spacing: .5px; }
.stat.accent .value { color: var(--accent-2); }

/* ---------- 表单 ---------- */
label { display: block; color: var(--dim); font-size: 12.5px; margin: 0 0 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0c1212;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.field { margin-bottom: 14px; }
.help { color: var(--dim); font-size: 12px; margin-top: 5px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { border-color: #2f4240; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: #ffb4b4; border-color: #5a2a2a; background: #241414; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=text] { width: 220px; }
.toolbar select { width: auto; }
.toolbar .grow { flex: 1; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #131a1a; color: var(--dim); font-weight: 500; font-size: 12px; letter-spacing: .3px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #131b1b; }
code.mono, .mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: .4px;
  color: #b8f0d6;
}
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; }
.tag-unused { background: #16332a; color: #7fe0b4; }
.tag-used { background: #1c2530; color: #8fb4d8; }
.tag-disabled { background: #33201f; color: #e0a2a0; }
.tag-plus { background: #1d2a33; color: #8fc4dd; }
.tag-pro { background: #16332a; color: #7fe0b4; }
.tag-warn { background: #3a2a17; color: #e8bd7a; }

/* ---------- 详情页 ---------- */
.panel h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: #cfe0dd;
  letter-spacing: .3px;
}
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.two-col > .panel { margin-bottom: 18px; }
.inline-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  margin: 0;
}
.inline-label input[type=checkbox] { width: auto; }
table.kv { border-collapse: collapse; }
table.kv th {
  width: 120px;
  background: transparent;
  color: var(--dim);
  font-weight: 400;
  font-size: 12.5px;
}
table.kv th, table.kv td { border-bottom: 1px solid var(--line); padding: 8px 10px; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }
textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
input[type=date] {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0c1212;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
input[type=date]:focus { border-color: var(--accent); }
.nowrap { white-space: nowrap; }
.nowrap form { margin-left: 6px; }

.empty { text-align: center; color: var(--dim); padding: 40px 0; }

/* ---------- 翻页 ---------- */
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; }
.pager a, .pager span {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text);
}
.pager span.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager span.disabled { color: #45504f; }

/* ---------- 提示 ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash-ok { background: #12301f; border: 1px solid #1d5c43; color: #9af0c6; }
.flash-err { background: #331a19; border: 1px solid #6b2b2b; color: #ffb4b4; }

.copy { cursor: pointer; border-bottom: 1px dashed #3a4a48; }
.copy:hover { color: #fff; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; flex-direction: row; overflow-x: auto; align-items: center; }
  .brand, .sidebar-foot, .sidebar .spacer { display: none; }
  .main { padding: 16px; }
}
