:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e6eaf2;
  --surface: #ffffff;
  --canvas: #f4f6fb;
  --navy: #0b1220;
  --navy-2: #111b31;
  --indigo: #5b6cff;
  --indigo-dark: #4453e8;
  --green: #0e9f6e;
  --green-soft: #e8f8f1;
  --amber: #d97706;
  --amber-soft: #fff6e6;
  --red: #dc2626;
  --red-soft: #fdecec;
  --blue-soft: #eef1ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.18);
  --radius: 16px;
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 5px; font-size: 10px; font-weight: 700; letter-spacing: .17em; color: var(--muted); }

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 10%, rgba(91, 108, 255, .26), transparent 34%),
    radial-gradient(circle at 88% 84%, rgba(14, 159, 110, .18), transparent 32%),
    linear-gradient(145deg, #070c17 0%, #0d1729 55%, #0a1322 100%);
  color: #e8edf8;
}
.bg-orb { position: fixed; border-radius: 50%; filter: blur(8px); pointer-events: none; opacity: .55; }
.bg-orb-a { width: 420px; height: 420px; top: -180px; right: -120px; border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 0 120px rgba(91,108,255,.14); }
.bg-orb-b { width: 300px; height: 300px; bottom: -150px; left: -80px; border: 1px solid rgba(255,255,255,.06); box-shadow: inset 0 0 100px rgba(14,159,110,.12); }
.login-shell { position: relative; z-index: 1; width: min(430px, calc(100vw - 36px)); }
.login-card {
  padding: 42px 40px 30px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(23, 35, 58, .88), rgba(10, 18, 33, .92));
  box-shadow: 0 30px 90px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
}
.brand-mark {
  width: 54px; height: 54px; display: grid; place-items: center; color: #9eabff;
  border-radius: 16px; background: linear-gradient(145deg, rgba(91,108,255,.24), rgba(91,108,255,.06));
  border: 1px solid rgba(142,155,255,.24); margin-bottom: 22px;
}
.brand-mark svg { width: 32px; height: 32px; }
.brand-mark-sm { width: 40px; height: 40px; margin: 0; border-radius: 12px; flex: 0 0 auto; }
.brand-mark-sm svg { width: 24px; height: 24px; }
.login-card .eyebrow { color: #8fa0c8; }
.login-card h1 { margin: 0; font-size: 27px; letter-spacing: -.02em; font-weight: 700; }
.login-sub { margin: 9px 0 28px; color: #91a0bd; font-size: 13px; }
.login-form { display: grid; gap: 17px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field > span em { font-style: normal; color: var(--red); font-size: 10px; margin-left: 3px; }
.field input, .select {
  width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px;
  background: #fff; color: var(--ink); outline: none; transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .select:focus { border-color: #9aa5ff; box-shadow: 0 0 0 4px rgba(91,108,255,.12); }
.login-card .field > span { color: #a8b6d1; }
.login-card .field input { background: rgba(255,255,255,.055); border-color: rgba(255,255,255,.12); color: #f2f5ff; }
.login-card .field input::placeholder { color: #68789a; }
.login-card .field input:focus { border-color: rgba(142,155,255,.65); box-shadow: 0 0 0 4px rgba(91,108,255,.15); }
.form-error { min-height: 18px; font-size: 12px; color: #ff9c9c; line-height: 1.45; }
.form-error:empty { display: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 10px;
  font-size: 13px; font-weight: 650; transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #6675ff, #4f5fe8); box-shadow: 0 8px 20px rgba(91,108,255,.28); }
.btn-primary:hover { background: linear-gradient(135deg, #7582ff, #5867f0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #cdd5e6; background: #f8faff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; height: 46px; margin-top: 2px; }
.btn-danger { color: var(--red); border-color: #f2caca; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: #d6dcea; border-top-color: var(--indigo); }
@keyframes spin { to { transform: rotate(360deg); } }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; color: #677795; font-size: 10px; }
.login-foot i { width: 3px; height: 3px; border-radius: 50%; background: #41506c; }
.login-copyright { margin: 18px 0 0; text-align: center; color: #52617e; font-size: 11px; }

/* ---------- 管理后台 ---------- */
.app-body { background: var(--canvas); min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 20;
  display: flex; flex-direction: column; padding: 24px 18px 18px;
  color: #cbd5e1; background: linear-gradient(180deg, #0b1220, #0e1729 70%, #0b1424);
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 24px; }
.sidebar-brand strong { display: block; color: #f1f5ff; font-size: 16px; letter-spacing: -.01em; }
.sidebar-brand small { display: block; margin-top: 3px; color: #6f80a0; font-size: 10px; letter-spacing: .04em; }
.sidebar-nav { display: grid; gap: 5px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px;
  color: #8e9cb8; font-size: 13px; font-weight: 550; transition: .16s;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { color: #dfe6f7; background: rgba(255,255,255,.04); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(91,108,255,.22), rgba(91,108,255,.07)); box-shadow: inset 2px 0 0 #7d8bff; }
.sidebar-note {
  display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 13px 12px;
  border: 1px solid rgba(255,255,255,.06); border-radius: 11px; background: rgba(255,255,255,.025);
}
.sidebar-note strong { display: block; color: #cbd5e1; font-size: 11px; font-weight: 600; }
.sidebar-note small { display: block; margin-top: 3px; color: #637391; font-size: 9px; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #2dd4a0; box-shadow: 0 0 0 4px rgba(45,212,160,.1); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(45,212,160,0); } }
.sidebar-logout {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px;
  color: #7e8ca7; background: transparent; border: 0; border-radius: 9px; font-size: 12px; text-align: left;
}
.sidebar-logout:hover { color: #fca5a5; background: rgba(220,38,38,.08); }
.sidebar-logout svg { width: 16px; height: 16px; }
.main { margin-left: 236px; padding: 30px 34px 24px; min-height: 100vh; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.topbar h1 { margin: 0; font-size: 25px; letter-spacing: -.03em; font-weight: 720; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.admin-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; color: var(--ink-2); font-size: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.admin-chip i { width: 7px; height: 7px; border-radius: 50%; background: #22c58b; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin-bottom: 22px; }
.stat-card {
  display: flex; align-items: flex-start; gap: 12px; min-height: 112px; padding: 17px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.stat-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; }
.stat-icon svg { width: 18px; height: 18px; }
.stat-card > div:last-child { display: grid; gap: 2px; min-width: 0; }
.stat-card span { color: var(--muted); font-size: 11px; }
.stat-card strong { color: var(--ink); font-size: 25px; line-height: 1.15; letter-spacing: -.03em; }
.stat-card small { color: #9aa6ba; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-total .stat-icon { color: #5b6cff; background: var(--blue-soft); }
.stat-active .stat-icon { color: var(--green); background: var(--green-soft); }
.stat-unused .stat-icon { color: #7c8cff; background: #f1f3ff; }
.stat-warn .stat-icon { color: var(--amber); background: var(--amber-soft); }
.stat-check .stat-icon { color: #0ea5b7; background: #e8f9fb; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px 22px 18px; border-bottom: 1px solid #eef1f6; }
.panel-head h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; color: #94a3b8; transform: translateY(-50%); }
.search-box input { width: 235px; height: 36px; padding: 0 11px 0 33px; border: 1px solid var(--line); border-radius: 9px; outline: none; font-size: 12px; }
.search-box input:focus { border-color: #aab4ff; box-shadow: 0 0 0 3px rgba(91,108,255,.1); }
.select { width: 116px; height: 36px; padding: 0 9px; font-size: 12px; color: var(--ink-2); }
.toolbar .btn-ghost { width: 36px; padding: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.license-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.license-table th {
  padding: 11px 16px; color: #8390a5; font-size: 10px; font-weight: 650; text-align: left; letter-spacing: .04em;
  background: #fbfcfe; border-bottom: 1px solid #eef1f6; white-space: nowrap;
}
.license-table td { padding: 14px 16px; border-bottom: 1px solid #f0f3f8; font-size: 12px; vertical-align: middle; }
.license-table tbody tr { transition: background .15s; }
.license-table tbody tr:hover { background: #fafbff; }
.license-table tbody tr:last-child td { border-bottom: 0; }
.th-actions { text-align: right !important; }
.card-key { display: inline-flex; align-items: center; gap: 7px; font-family: "Cascadia Mono", Consolas, monospace; font-size: 11.5px; font-weight: 650; color: #26324a; letter-spacing: .01em; }
.copy-mini { width: 24px; height: 24px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: #8794ab; background: #fff; }
.copy-mini:hover { color: var(--indigo); border-color: #c7ceff; background: #f7f8ff; }
.copy-mini svg { width: 12px; height: 12px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 8px; border-radius: 20px; font-size: 10px; font-weight: 650; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-active { color: var(--green); background: var(--green-soft); }
.status-unused { color: #5b6cff; background: var(--blue-soft); }
.status-expired { color: var(--amber); background: var(--amber-soft); }
.status-revoked { color: var(--red); background: var(--red-soft); }
.hw-cell { display: grid; gap: 3px; max-width: 200px; }
.hw-cell strong { font-size: 11px; font-weight: 600; color: #39465e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-cell small { font-size: 9px; color: #9aa6ba; font-family: Consolas, monospace; }
.muted { color: #9aa6ba; }
.empty-note { font-size: 11px; }
.time-main { display: block; color: #3e4c63; font-size: 11.5px; }
.time-sub { display: block; margin-top: 3px; color: #98a5b9; font-size: 9.5px; }
.days-left { color: var(--green); font-weight: 650; }
.days-left.warn { color: var(--amber); }
.days-left.danger { color: var(--red); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.row-actions .btn { height: 29px; padding: 0 9px; font-size: 10.5px; border-radius: 7px; }
.table-loading, .table-empty { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 42px 0; color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--muted); font-size: 11px; border-top: 1px solid #eef1f6; }
.pager-btns { display: flex; gap: 6px; }
.pager-btns .btn:disabled { opacity: .4; cursor: not-allowed; }
.main-foot { padding: 18px 0 0; color: #a1acbf; font-size: 10px; text-align: center; }

/* ---------- 弹窗 / 抽屉 ---------- */
.modal-backdrop, .drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 18, 33, .55); backdrop-filter: blur(3px); }
.modal-backdrop { display: grid; place-items: center; padding: 20px; }
.modal {
  width: min(540px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: #fff;
  border-radius: 18px; box-shadow: var(--shadow-lg); animation: modalIn .18s ease-out;
}
.modal-sm { width: min(430px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px 14px; }
.modal-head h3 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; color: #8491a7; background: transparent; font-size: 22px; line-height: 1; }
.icon-btn:hover { background: #f1f4fa; color: var(--ink); }
.modal-body { padding: 8px 24px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.modal-body .field { margin-bottom: 14px; }
.modal-tip { padding: 11px 13px; color: #64748b; background: #f6f8fc; border: 1px solid #edf0f6; border-radius: 9px; font-size: 10.5px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.success-banner { display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 14px; background: var(--green-soft); border: 1px solid #c6f0de; border-radius: 11px; }
.success-check { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--green); border-radius: 50%; font-size: 16px; font-weight: 700; }
.success-banner strong { display: block; color: #087b56; font-size: 13px; }
.success-banner p { margin: 4px 0 0; color: #4d9079; font-size: 10.5px; }
.key-output {
  max-height: 230px; overflow: auto; margin: 0; padding: 14px; border: 1px dashed #c9d2e6; border-radius: 10px;
  background: #f8faff; color: #2b3a55; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; line-height: 1.9; white-space: pre-wrap;
}
.renew-card { margin: 0 0 15px; padding: 10px 12px; color: #3e4c63; background: #f6f8fc; border-radius: 8px; font-family: Consolas, monospace; font-size: 11px; }
.drawer-backdrop { z-index: 70; }
.drawer {
  position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); display: flex; flex-direction: column;
  background: #fff; box-shadow: -20px 0 60px rgba(15,23,42,.16); animation: drawerIn .2s ease-out;
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: .5; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 25px 16px; border-bottom: 1px solid #eef1f6; }
.drawer-head h3 { margin: 0; font-size: 19px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 25px 32px; }
.detail-section { margin-bottom: 22px; }
.detail-section h4 { margin: 0 0 10px; color: #7b879c; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.detail-card { padding: 14px; background: #f8faff; border: 1px solid #edf1f8; border-radius: 11px; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: 11.5px; }
.detail-row span { color: #8794ab; white-space: nowrap; }
.detail-row strong { color: #334155; font-weight: 600; text-align: right; word-break: break-all; font-family: Consolas, "Microsoft YaHei UI", sans-serif; }
.hw-block { display: grid; gap: 7px; }
.hw-block div { display: flex; gap: 8px; font-size: 11px; }
.hw-block span { color: #8794ab; width: 48px; flex: 0 0 auto; }
.hw-block code { color: #3e4c63; font-family: Consolas, monospace; word-break: break-all; }
.timeline { position: relative; padding-left: 16px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 1px; background: #e6eaf2; }
.timeline-item { position: relative; padding: 0 0 13px 6px; }
.timeline-item::before { content: ""; position: absolute; left: -15px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: #c7d0e1; border: 2px solid #fff; }
.timeline-item.ok::before { background: #22c58b; }
.timeline-item.fail::before { background: #ef4444; }
.timeline-item strong { display: block; color: #3e4c63; font-size: 11px; }
.timeline-item small { display: block; margin-top: 3px; color: #9aa6ba; font-size: 9.5px; }
.timeline-item p { margin: 4px 0 0; color: #8794ab; font-size: 10px; }
.toast-box { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 9px; min-width: 220px; padding: 11px 14px; color: #e8edf8; background: #111b2e; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; box-shadow: 0 12px 30px rgba(15,23,42,.28); font-size: 12px; animation: toastIn .2s ease-out; }
.toast.ok { border-left: 3px solid #22c58b; }
.toast.err { border-left: 3px solid #ef4444; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1250px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; gap: 12px; }
  .sidebar-brand { padding: 0; margin-right: auto; }
  .sidebar-brand small, .sidebar-note, .sidebar-logout { display: none; }
  .sidebar-nav { display: flex; margin: 0; }
  .nav-item { padding: 9px 10px; }
  .nav-item span { display: none; }
  .main { margin-left: 0; padding: 22px 16px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 21px; }
  .topbar-right { gap: 8px; }
  .admin-chip { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .toolbar { width: 100%; flex-wrap: wrap; }
  .search-box { flex: 1; min-width: 170px; }
  .search-box input { width: 100%; }
}
@media (max-width: 560px) {
  .login-card { padding: 32px 24px 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 100px; padding: 13px; }
  .stat-card strong { font-size: 22px; }
  .stat-card small { display: none; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .modal-actions { flex-wrap: wrap; }
}
