:root {
  --bg: #0b1020;
  --panel: #121a2e;
  --panel2: #18223b;
  --text: #e8eefc;
  --muted: #93a1bd;
  --line: #26324d;
  --primary: #4f8cff;
  --primary2: #356ee0;
  --danger: #e14b5a;
  --ok: #35c48a;
  --warn: #e3a93b;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }
.danger-text { color: var(--danger); font-size: 13px; }
code { color: #9cc3ff; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 9px 14px; color: var(--text); background: var(--panel2); }
button.primary { background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary2); }
button.secondary { background: #22304c; }
button.danger { background: var(--danger); color: #fff; }
button.link { background: transparent; color: #9cc3ff; padding: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: #0d1426; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { display: block; color: var(--muted); font-size: 13px; }
label input, label select { margin-top: 6px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); padding-top: 20px; }
label.check input { width: auto; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.form { display: grid; gap: 14px; margin-top: 20px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.sidebar { background: #0a0f1d; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 6px; }
.brand { font-weight: 700; font-size: 18px; padding: 8px 12px 18px; }
.nav { text-align: left; background: transparent; color: var(--muted); padding: 10px 12px; border-radius: 8px; }
.nav:hover { background: var(--panel); color: var(--text); }
.nav.active { background: var(--panel2); color: #fff; }
.spacer { flex: 1; }
.main { padding: 24px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.topbar h2 { margin: 0 0 4px; font-size: 22px; }
.topbar p { margin: 0; }
.user { color: var(--muted); background: var(--panel); padding: 7px 12px; border-radius: 999px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 14px; font-size: 17px; }
.panel-inner { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-form .wide { grid-column: 1 / -1; }
.grid-form textarea { min-height: 110px; margin-top: 6px; font-family: Consolas, monospace; resize: vertical; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; }
.toolbar, .batchbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.batchbar { background: #0d1426; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.batchbar input.small, .batchbar select.small { width: 90px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: #0d1426; position: sticky; top: 0; }
td .mono, .mono { font-family: Consolas, "Courier New", monospace; }
td input[type=checkbox], th input[type=checkbox] { width: auto; }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #22304c; }
.status.ACTIVE { background: rgba(53,196,138,.15); color: var(--ok); }
.status.EXPIRED { background: rgba(227,169,59,.15); color: var(--warn); }
.status.REVOKED, .status.DISABLED { background: rgba(225,75,90,.15); color: #ff8a95; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.generated { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.generated textarea { height: 160px; margin-top: 10px; font-family: Consolas, monospace; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview { background: #0d1426; border: 1px solid var(--line); padding: 12px; border-radius: 8px; }
.question { color: #ffd479; min-height: 20px; }
.toast { position: fixed; right: 22px; top: 22px; z-index: 50; max-width: 380px; padding: 12px 16px; border-radius: 10px; background: #22304c; border: 1px solid var(--line); opacity: 0; transform: translateY(-8px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #4a1d26; border-color: #7b2d3a; }
.toast.ok { background: #12352b; border-color: #1f6b52; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-card label { margin-top: 12px; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { width: 100%; padding-bottom: 8px; }
  .spacer { display: none; }
  .main { padding: 16px; }
}
