/* 卡密管理系统 · 统一主题 */
:root {
  --bg: #0B0F17;
  --bg2: #121826;
  --bg3: #151C2B;
  --line: #1E2738;
  --line2: #253148;
  --text: #E6EBF5;
  --text2: #9AA5B8;
  --text3: #6B7A93;
  --accent: #3D7BFF;
  --accent2: #4E88FF;
  --ok: #3DDB85;
  --warn: #F5A623;
  --bad: #F5533D;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: Consolas, "Courier New", monospace; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: var(--bg2);
  border-right: 1px solid var(--line); padding: 0; display: flex; flex-direction: column;
}
.brand {
  padding: 20px 20px 16px; border-bottom: 1px solid var(--line);
}
.brand h1 { font-size: 15px; margin: 0; letter-spacing: .3px; }
.brand .sub { font-size: 11px; color: var(--text3); margin-top: 3px; }
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-radius: 8px; color: var(--text2); font-size: 13.5px;
  text-decoration: none; margin-bottom: 2px; transition: .12s;
}
.nav a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(61,123,255,.15); color: #7EA8FF; font-weight: 600; }
.nav .grp {
  font-size: 11px; color: var(--text3); padding: 14px 12px 6px;
  letter-spacing: .5px; text-transform: uppercase;
}
.nav .ico { width: 16px; text-align: center; opacity: .85; }
.sidebar .foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text3);
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: 0 0 56px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
  background: var(--bg2);
}
.topbar .title { font-size: 15px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12.5px; color: var(--text2); }
.content { padding: 24px; flex: 1; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.card > h2 {
  font-size: 13px; margin: 0 0 16px; color: #8FA3C0;
  font-weight: 600; letter-spacing: .5px;
}
.card > h2 .r { float: right; font-weight: 400; font-size: 12px; color: var(--text3); }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat .lbl { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.stat .num { font-size: 30px; font-weight: 700; line-height: 1.25; margin-top: 6px;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat .hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.stat .bar { position: absolute; left: 0; top: 0; width: 3px; height: 100%; }
.b-blue { background: var(--accent); }
.b-green { background: var(--ok); }
.b-orange { background: var(--warn); }
.b-purple { background: #9B6BFF; }
.b-cyan { background: #2BC7D8; }
.c-blue { color: #7EA8FF; }
.c-green { color: var(--ok); }
.c-orange { color: var(--warn); }
.c-purple { color: #B78BFF; }
.c-cyan { color: #4FD6E4; }

/* ---------- 表格 ---------- */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; color: #8FA3C0; font-weight: 600; padding: 9px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px;
}
td { padding: 9px 10px; border-bottom: 1px solid #161E2E; white-space: nowrap; }
td.nm, th.nm { white-space: nowrap; min-width: 96px; }
tbody tr:hover td { background: var(--bg3); }
td.wrap, th.wrap { white-space: normal; }
.empty { text-align: center; color: var(--text3); padding: 34px 0; font-size: 13px; }

/* ---------- 表单 ---------- */
label.f { display: block; font-size: 12px; color: var(--text2); margin: 0 0 5px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  background: var(--bg); border: 1px solid var(--line2); color: var(--text);
  border-radius: 8px; padding: 8px 11px; font: 13px "Microsoft YaHei UI", sans-serif;
  outline: none; transition: .12s; width: 100%; max-width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: var(--text3); }
select { cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > .col { flex: 0 0 auto; }
.row > .grow { flex: 1 1 180px; min-width: 120px; }
.w-sm { width: 90px !important; }
.w-md { width: 150px !important; }
.w-lg { width: 240px !important; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent);
  color: #fff; border: 0; border-radius: 8px; padding: 9px 17px;
  font: 13px "Microsoft YaHei UI", sans-serif; cursor: pointer;
  white-space: nowrap; transition: .12s;
}
.btn:hover { background: var(--accent2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gray { background: var(--line2); }
.btn.gray:hover { background: #2E3D59; }
.btn.red { background: var(--bad); }
.btn.red:hover { background: #FF6257; }
.btn.green { background: #1E9E5E; }
.btn.green:hover { background: #24B66D; }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 6px; }
.btn.xs { padding: 3px 9px; font-size: 11.5px; border-radius: 5px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 1px 9px; border-radius: 20px;
  font-size: 11px; line-height: 18px; white-space: nowrap;
}
.tag.ok { background: rgba(61,219,133,.14); color: var(--ok); }
.tag.bad { background: rgba(245,83,61,.14); color: var(--bad); }
.tag.warn { background: rgba(245,166,35,.14); color: var(--warn); }
.tag.mut { background: rgba(154,165,184,.12); color: var(--text2); }
.tag.blue { background: rgba(61,123,255,.14); color: #7EA8FF; }
.tag.purple { background: rgba(155,107,255,.14); color: #B78BFF; }

/* ---------- 提示 ---------- */
.flash {
  padding: 11px 16px; border-radius: 9px; margin-bottom: 16px; font-size: 13px;
  border-left: 3px solid;
}
.flash.ok { background: rgba(61,219,133,.09); border-color: var(--ok); color: #7FE3AC; }
.flash.err { background: rgba(245,83,61,.09); border-color: var(--bad); color: #FF8A7A; }
.flash.info { background: rgba(61,123,255,.09); border-color: var(--accent); color: #9CBCFF; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 6px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 5px 11px; border-radius: 7px; font-size: 12.5px;
  border: 1px solid var(--line2); color: var(--text2); text-decoration: none;
}
.pager a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.pager .cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .dis { opacity: .35; }
.pager .info { border: 0; color: var(--text3); padding-left: 4px; }

/* ---------- 弹层 ---------- */
dialog, .modal {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line2);
  border-radius: 14px; padding: 0; max-width: 560px; width: calc(100% - 32px);
}
dialog::backdrop { background: rgba(0,0,0,.62); }
.modal .mh {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
}
.modal .mb { padding: 20px; }
.modal .mf {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #16203A 0%, var(--bg) 62%);
  padding: 20px;
}
.login-box {
  width: 100%; max-width: 380px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-box h1 { font-size: 18px; margin: 0 0 4px; text-align: center; }
.login-box .sub { font-size: 12px; color: var(--text3); text-align: center; margin-bottom: 24px; }
.login-box .field { margin-bottom: 14px; }
.login-box .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }
.login-box .tip { font-size: 11.5px; color: var(--text3); text-align: center; margin-top: 18px; line-height: 1.9; }

/* ---------- 权限勾选 ---------- */
.perms { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.perm-item {
  display: flex; align-items: flex-start; gap: 9px; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--line2); border-radius: 8px;
  cursor: pointer; transition: .12s;
}
.perm-item:hover { border-color: var(--accent); }
.perm-item input { margin: 3px 0 0; width: 15px; height: 15px; cursor: pointer; flex: 0 0 auto; }
.perm-item .pn { font-size: 12.5px; }
.perm-item .pd { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ---------- 图表 ---------- */
.chart-box { height: 200px; display: flex; align-items: flex-end; gap: 8px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; gap: 5px; align-items: flex-end; height: 150px; width: 100%; justify-content: center; }
.chart-bar { width: 22px; border-radius: 4px 4px 0 0; min-height: 3px; transition: .3s; }
.chart-bar.new { background: var(--accent); }
.chart-bar.used { background: var(--ok); }
.chart-lbl { font-size: 10.5px; color: var(--text3); }
.legend { display: flex; gap: 16px; font-size: 11.5px; color: var(--text2); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.tagrow { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .sidebar { width: 60px; flex: 0 0 60px; }
  .brand h1, .brand .sub, .nav a span.tx, .nav .grp, .sidebar .foot { display: none; }
  .nav a { justify-content: center; padding: 11px; }
  .content { padding: 16px; }
  .stat .num { font-size: 24px; }
}
