:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e3e7ec;
  --accent: #0b7285;
  --ok: #2b8a3e;
  --warn: #e8590c;
  --danger: #c92a2a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

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

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

.topbar {
  background: #11202b;
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 56px;
}
.topbar .brand { font-weight: 600; font-size: 15px; letter-spacing: .3px; }
.topbar nav { display: flex; gap: 20px; flex: 1; }
.topbar nav a { color: #b9c6d1; font-size: 14px; }
.topbar nav a:hover, .topbar nav a.active { color: #fff; text-decoration: none; }
.topbar nav a.active { font-weight: 600; }
.topbar .logout { color: #8fa3b3; font-size: 13px; }

.wrap { max-width: 1180px; margin: 24px auto 60px; padding: 0 24px; }

h1 { font-size: 20px; margin: 0 0 18px; }
h2 { font-size: 15px; margin: 0 0 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}

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

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash.ok  { background: #e6fcf5; color: #0b7285; border: 1px solid #96f2d7; }
.flash.err { background: #fff5f5; color: var(--danger); border: 1px solid #ffc9c9; }

/* ---------------------------------------------------------- 统计卡 */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 26px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value.ok { color: var(--ok); }
.stat .value.warn { color: var(--warn); }
.stat .value.danger { color: var(--danger); }

/* ---------------------------------------------------------- 趋势图 */

.trend { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding-top: 8px; }
.trend .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .fill { width: 100%; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 3px; }
.trend .n { font-size: 12px; font-variant-numeric: tabular-nums; }
.trend .d { font-size: 11px; color: var(--muted); }

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

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
td.mono, .mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
td.num { font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 28px; font-size: 13px; }

/* ---------------------------------------------------------- 徽标 */

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; line-height: 1.5; }
.tag.active  { background: #e6fcf5; color: #0b7285; }
.tag.expired { background: #fff4e6; color: var(--warn); }
.tag.revoked { background: #fff5f5; color: var(--danger); }
.tag.free    { background: #e7f5ff; color: #1971c2; }
.tag.used    { background: #f1f3f5; color: var(--muted); }

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

form.inline { display: inline; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }

input, select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid #a5d8e4; outline-offset: -1px; border-color: var(--accent); }

button {
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button.ghost:hover { background: #f1f3f5; filter: none; }
button.danger { background: var(--danger); }
button.small { padding: 4px 9px; font-size: 12px; }

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

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }
.login-card h1 { text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-card button { width: 100%; padding: 9px; }

details.actions summary { cursor: pointer; color: var(--accent); font-size: 12px; list-style: none; }
details.actions summary::-webkit-details-marker { display: none; }
details.actions .panel { margin-top: 8px; padding: 10px; background: #fafbfc; border: 1px solid var(--line); border-radius: 7px; }
