:root {
  --bg: #0b1220;
  --panel: #0d1b2a;
  --panel-2: #101e33;
  --line: #22304d;
  --line-2: #2d3f60;
  --text: #e2e8f0;
  --muted: #8ea0c0;
  --teal: #4fd1c5;
  --green: #38a169;
  --yellow: #f6c344;
  --red: #f56565;
  --blue: #63b3ed;
  --purple: #b794f4;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #12233a 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
a { color: var(--teal); text-decoration: none; }
code { background: #0a1524; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* 登录 */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 380px; max-width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.brand.small { font-size: 15px; padding: 6px 4px 18px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 12px var(--teal); }
.login-card form { margin-top: 18px; display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select, textarea {
  width: 100%; background: #0a1524; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 11px; font-size: 13px; outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(79,209,197,.12); }
textarea { min-height: 76px; resize: vertical; }
.hint { margin: 14px 0 0; font-size: 12px; color: #66788a; line-height: 1.6; }

/* 按钮 */
.btn {
  cursor: pointer; border: 1px solid var(--line-2); background: #13233a; color: var(--text);
  border-radius: 8px; padding: 8px 13px; font-size: 13px; font-family: inherit;
  transition: .15s;
}
.btn:hover { border-color: var(--teal); color: #fff; }
.btn.primary { background: linear-gradient(180deg, #2f9e8f, #237a6e); border-color: #2f9e8f; font-weight: 700; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.danger { border-color: #7b2d2d; color: #ff9b9b; background: #2a1518; }
.btn.danger:hover { border-color: var(--red); color: #fff; }
.btn.warn { border-color: #6b5620; color: var(--yellow); background: #241f10; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  cursor: pointer; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1;
  padding: 2px 8px; border-radius: 6px;
}
.icon-btn:hover { color: #fff; background: #1a2744; }

/* 布局 */
.app { display: flex; min-height: 100%; }
.sidebar {
  width: 208px; flex: 0 0 208px; background: rgba(10,20,34,.86); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar nav { flex: 1; padding: 4px 10px; display: grid; gap: 2px; align-content: start; overflow: auto; }
.sidebar nav a {
  color: var(--muted); padding: 9px 11px; border-radius: 8px; font-size: 13px; border: 1px solid transparent;
}
.sidebar nav a:hover { background: #10203a; color: var(--text); }
.sidebar nav a.active { background: #112b3d; border-color: #1e4b60; color: var(--teal); font-weight: 700; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.whoami { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 22px; background: rgba(11,18,32,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 19px; letter-spacing: .3px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; }
.content { padding: 18px 22px 40px; }

/* 卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  position: relative; overflow: hidden;
}
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .sub { font-size: 11px; color: #66788a; margin-top: 4px; }
.card.accent::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: rgba(79,209,197,.12); }
.card.warn::after { background: rgba(246,195,68,.14); }
.card.bad::after { background: rgba(245,101,101,.14); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 15px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; padding: 7px 9px; }
.spacer { flex: 1; }

/* 表格 */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid #1b2942; vertical-align: middle; }
th { background: #0f1b2e; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:hover td { background: rgba(79,209,197,.04); }
td .row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; }

/* 标签 */
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid; white-space: nowrap; }
.chip.active { color: #7bdcb5; border-color: #2f6b52; background: #0e2a22; }
.chip.expired { color: var(--yellow); border-color: #6b5620; background: #241f10; }
.chip.revoked { color: #ff9b9b; border-color: #7b2d2d; background: #2a1518; }
.chip.trial { color: var(--purple); border-color: #4c3b78; background: #1b1530; }
.chip.frozen { color: #ffb4b4; border-color: #7b2d2d; background: #2a1518; }
.chip.unbound { color: #8b9bb4; border-color: #33435e; background: #131c2c; }
.chip.desktop { color: var(--blue); border-color: #2b5d80; background: #0e2333; }
.chip.mobile { color: var(--purple); border-color: #4c3b78; background: #1b1530; }
.chip.online { color: #7bdcb5; border-color: #2f6b52; background: #0e2a22; }
.chip.offline { color: #8b9bb4; border-color: #33435e; background: #131c2c; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 11px; color: var(--blue); background: #10263a; border-radius: 4px; padding: 1px 6px; }
/* 客户名称优先展示：名称大字，机器码/授权号灰小字第二行 */
.who { font-size: 14px; font-weight: 600; color: #e8f1fb; line-height: 1.35; }
td .who + .muted { margin-top: 2px; }

/* 图表 */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar i { display: block; width: 100%; max-width: 34px; background: linear-gradient(180deg, #4fd1c5, #237a6e); border-radius: 5px 5px 0 0; min-height: 2px; }
.bar span { font-size: 10px; color: #66788a; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4,8,15,.75); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  width: 560px; max-width: 100%; max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.modal-head h2 { margin: 0; font-size: 16px; }
#modalBody { padding: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.checks label { display: flex; align-items: center; gap: 6px; color: var(--text); background: #0a1524; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.checks input { width: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.notice { font-size: 12px; color: var(--muted); line-height: 1.7; background: #0a1524; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.notice b { color: var(--yellow); }

/* Toast */
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  background: #12233a; border: 1px solid var(--teal); color: var(--text);
  border-radius: 10px; padding: 11px 16px; font-size: 13px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
  max-width: 420px;
}
.toast.err { border-color: var(--red); color: #ffd0d0; }

@media (max-width: 860px) {
  .sidebar { position: static; width: 100%; height: auto; flex: none; }
  .app { flex-direction: column; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 8px; }
  .sidebar nav a { padding: 7px 10px; }
  .sidebar-foot { display: flex; justify-content: space-between; }
  .form-grid { grid-template-columns: 1fr; }
}
