/* LQ卡密管理台。颜色、间距、圆角、阴影、字号都从这里取。 */
:root {
  color-scheme: light;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "PingFang SC", "Microsoft YaHei", monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --text-xs: 12px;
  --text-sm: 13px;
  --text: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 28px;

  --bg: #f4f6f8;
  --bg-sunken: #e8edf2;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #101828;
  --muted: #475467;
  --faint: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;

  --accent: #175cd3;
  --accent-hover: #1849a9;
  --accent-ink: #ffffff;
  --accent-soft: #eff4ff;
  --accent-soft-ink: #1849a9;

  --danger: #d92d20;
  --danger-ink: #b42318;
  --danger-soft: #fef3f2;
  --danger-btn: #d92d20;
  --danger-btn-hover: #b42318;
  --danger-btn-ink: #ffffff;

  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;

  --th: #f8fafc;
  --zebra: #f8fafc;
  --row-hover: #f3f7ff;
  --low-bg: #fff6f5;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  --shadow-lg: 0 24px 48px rgba(16, 24, 40, 0.18);
  --focus: 0 0 0 3px rgba(23, 92, 211, 0.28);
  --scrim: rgba(8, 10, 14, 0.46);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --bg-sunken: #090b10;
  --surface: #171a21;
  --surface-2: #1f242e;
  --ink: #f2f4f7;
  --muted: #c5ccd6;
  --faint: #98a2b3;
  --line: #2c313a;
  --line-strong: #3a4250;

  --accent: #9ec1ff;
  --accent-hover: #c3d7ff;
  --accent-ink: #0e1424;
  --accent-soft: rgba(158, 193, 255, 0.16);
  --accent-soft-ink: #d6e4ff;

  --danger: #ff7a72;
  --danger-ink: #ffc7c3;
  --danger-soft: rgba(240, 68, 56, 0.16);
  --danger-btn: #e11d2e;
  --danger-btn-hover: #f04438;
  --danger-btn-ink: #ffffff;

  --ok: #75e0a7;
  --ok-soft: rgba(71, 205, 137, 0.16);
  --warn: #fec84b;
  --warn-soft: rgba(254, 200, 75, 0.14);

  --th: #1f242e;
  --zebra: rgba(255, 255, 255, 0.03);
  --row-hover: rgba(158, 193, 255, 0.1);
  --low-bg: rgba(240, 68, 56, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.5);
  --focus: 0 0 0 3px rgba(158, 193, 255, 0.35);
  --scrim: rgba(0, 0, 0, 0.62);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font);
  font-size: var(--text);
  line-height: 1.5;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
::selection { background: var(--accent-soft); color: var(--ink); }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(340px, 1.08fr);
  background: var(--bg);
}
.login-hero {
  color: #f8fafc;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: #12151c;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
}
.hero-brand, .side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-brand strong { display: block; font-size: 16px; }
.hero-brand span:last-child, .side-brand small { color: #98a2b3; font-size: var(--text-xs); }
.login-hero h1 {
  margin: 36px 0 12px;
  font-size: 40px;
  line-height: 1.25;
  font-weight: 700;
  max-width: 12em;
}
.login-hero > p { max-width: 28em; color: rgba(248, 250, 252, 0.78); font-size: 15px; }
.hero-points { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 12px; }
.hero-points li { display: flex; gap: 10px; align-items: flex-start; color: rgba(248, 250, 252, 0.86); }
.hero-points li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-radius: 99px;
  background: #9ec1ff;
  flex: none;
}
.login-main { position: relative; display: grid; place-items: center; padding: 32px 24px; }
.login-theme { position: absolute; top: 20px; right: 20px; }
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 24px 22px;
}
.login-card h2 { font-size: 24px; font-weight: 700; }
.lede { color: var(--muted); margin: 8px 0 18px; line-height: 1.55; }
.mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 13px;
  flex: none;
}
.login-hero .mark { background: #f8fafc; color: #12151c; }

.shell { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
  width: 248px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 12px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 4px 8px 10px;
  border-radius: var(--radius);
}
.side-brand:hover { background: var(--surface-2); }
.side-brand strong { display: block; font-size: 15px; }
.side-brand small { display: block; color: var(--muted); }
.nav { flex: 1; overflow: auto; padding-bottom: 8px; }
.nav-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  padding: 14px 10px 6px;
}
.nav-item, .side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: var(--text);
}
.side-btn { font-size: var(--text-sm); }
.nav-item svg, .side-btn svg { flex: none; }
.nav-item:hover, .side-btn:hover, .side-brand:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-weight: 700;
}
.nav-item:focus-visible, .side-btn:focus-visible, .side-brand:focus-visible, .icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.side-foot { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.workspace { flex: 1; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: var(--text-lg); font-weight: 700; }
.top-title p { font-size: var(--text-sm); margin-top: 2px; }
.clock { color: var(--muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.view { padding: 20px 28px 56px; }
#nav-toggle { display: none; }
.scrim { display: none; }

.icon-btn, .text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.icon-btn { width: 36px; height: 36px; padding: 0; }
.icon-btn:hover { background: var(--surface-2); }

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat, .card, .callout {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.stat { border-radius: 14px; padding: 14px 14px 12px; min-width: 0; }
.stat-kicker { color: var(--muted); font-size: var(--text-xs); font-weight: 700; }
.stat-value {
  display: block;
  margin-top: 8px;
  font-size: var(--text-xl);
  line-height: 1.1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-note { display: block; margin-top: 6px; color: var(--faint); font-size: var(--text-xs); }
.stat-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.stat-warn .stat-value { color: var(--warn); }
.callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
}
.callout p { margin-top: 4px; color: var(--muted); font-size: var(--text-sm); line-height: 1.55; }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.card { border-radius: 14px; margin-bottom: 16px; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px 0;
}
.card-head h2 { font-size: var(--text-md); font-weight: 700; }
.card-body { padding: 14px 18px 18px; }
.card-body h3 { margin: 14px 0 8px; font-size: 14px; font-weight: 700; }
.help { color: var(--muted); font-size: var(--text-sm); line-height: 1.6; margin: 8px 0 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr); gap: 16px; align-items: start; }
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: var(--text-sm); font-weight: 600; }
.field > span, .check { color: var(--muted); font-weight: 600; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 14px; }
.fields + .fields, .field + .fields, .fields + .field, .help + .field, .field + .help { margin-top: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  font-weight: 400;
}
textarea { min-height: 132px; resize: vertical; line-height: 1.5; }
textarea:read-only { background: var(--surface-2); color: var(--muted); }
.paste-hold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: var(--text-sm);
}
.paste-hold.hidden { display: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
input[type="file"] { padding: 8px; background: var(--surface-2); }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  padding: 6px 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.secret { position: relative; display: block; color: var(--ink); }
.low-num { color: var(--danger); font-weight: 700; }
.secret input { padding-right: 64px; }
.text-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
  font-size: var(--text-sm);
  font-weight: 600;
}
.checks { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 12px 0; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-weight: 700;
  font-size: var(--text);
  line-height: 1.2;
  text-decoration: none;
  background: var(--surface);
  color: var(--ink);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger-btn); color: var(--danger-btn-ink); }
.btn-danger:hover:not(:disabled) { background: var(--danger-btn-hover); }
.btn-sm { padding: 6px 10px; font-size: var(--text-sm); border-radius: 8px; }
.btn-block { width: 100%; }
td .btn { white-space: nowrap; }
td input, td select { min-width: 0; }

.table-scroll {
  max-height: min(68vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; }
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--th);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  box-shadow: inset 0 -1px 0 var(--line);
}
td { border-bottom: 1px solid var(--line); background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: var(--zebra); }
tbody tr:hover td { background: var(--row-hover); }
tbody tr.is-low td { background: var(--low-bg); }
tbody tr.is-low:hover td { background: var(--low-bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clip { max-width: 420px; word-break: break-all; white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.fit { width: 1%; white-space: nowrap; }
.table-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 2px 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
.pager-btns { display: flex; align-items: center; gap: 8px; }
.pager-index { font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.7;
  white-space: nowrap;
}
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-bad { background: var(--danger-soft); color: var(--danger-ink); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-info { background: var(--accent-soft); color: var(--accent-soft-ink); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; margin: 12px 0; }
.metrics div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.metrics strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.metrics span { color: var(--muted); font-size: var(--text-xs); }
.progress {
  height: 8px;
  background: var(--bg-sunken);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress > span { display: block; height: 100%; background: var(--accent); }
.progress-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin: 8px 0; font-size: var(--text-sm); }
.sample { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: line; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sample li {
  counter-increment: line;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
  white-space: pre-wrap;
  background: var(--surface);
}
.sample li:last-child { border-bottom: 0; }
.sample li:nth-child(even) { background: var(--zebra); }
.sample li::before { content: counter(line); color: var(--faint); }

.banner { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: var(--text-sm); line-height: 1.5; }
.banner[hidden] { display: none; }
.banner-ok { background: var(--ok-soft); color: var(--ok); }
.banner-err { background: var(--danger-soft); color: var(--danger-ink); }
.banner-info { background: var(--accent-soft); color: var(--accent-soft-ink); }
.form-error { color: var(--danger-ink); min-height: 1.2em; font-size: var(--text-sm); margin: 10px 0 0; }
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
}
.state strong { color: var(--ink); font-size: 15px; }
.state p { max-width: 440px; font-size: var(--text-sm); line-height: 1.55; }
.state-mark { color: var(--faint); }
.state-mark svg { width: 28px; height: 28px; }
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toasts {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
}
.toast-ok { border-left-color: var(--ok); }
.toast-err { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--accent); }
.toast-text { flex: 1; font-size: var(--text-sm); line-height: 1.45; }
.toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}
.toast-mark { display: inline-flex; margin-top: 1px; }
.toast-ok .toast-mark { color: var(--ok); }
.toast-err .toast-mark { color: var(--danger); }
.toast-info .toast-mark { color: var(--accent); }

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--scrim);
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
}
.modal h3 { font-size: 18px; font-weight: 700; }
.modal p { margin: 8px 0 18px; color: var(--muted); line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.facts { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: var(--text-sm); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.snippet {
  margin: 12px 0 0;
  background: var(--bg-sunken);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 1px 5px;
}

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .split, .split-even { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 24px 8px; }
  .login-hero h1 { margin-top: 20px; font-size: 32px; }
}
@media (max-width: 900px) {
  #nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
  }
  .sidebar.is-open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 35; }
  .scrim[hidden] { display: none !important; }
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 720px) {
  .stats, .metrics { grid-template-columns: 1fr 1fr; }
  .callout { flex-direction: column; align-items: stretch; }
  .facts { grid-template-columns: 1fr; }
  .clock { display: none; }
  .pager { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
