:root {
  --bg: #f4f6fa;
  --bg-1: #fff;
  --bg-2: #f3f5fa;
  --bg-3: #e8ebf3;
  --bd: #e6e9f0;
  --bd-2: #d5dae6;
  --fg: #1f2330;
  --fg-1: #5b6172;
  --fg-2: #7b8194;
  --fg-3: #9aa0b4;
  --accent: #5b5ce6;
  --accent-fg: #fff;
  --accent-weak: #eef0ff;
  --success: #17803d;
  --success-weak: #e8f8ee;
  --danger: #d92d20;
  --danger-weak: #fdecec;
  --warning: #d99a2b;
  --info: #2563eb;
  --st-exported: #8250df;
  --st-completed: #1a7f37;
  --st-completed-bg: #e6f6ec;
  --st-pending: #59636e;
  --st-pending-bg: #eef1f6;
  --st-processing: #0969da;
  --st-processing-bg: #e8f1fd;
  --st-failed: #cf222e;
  --st-failed-bg: #fbe9e9;
  --grad-accent: linear-gradient(135deg, #6d6ce0, #5151cc);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --r-1: 4px; --r-2: 6px; --r-3: 8px; --r-4: 12px; --r-full: 999px;
  --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
}
button, input, textarea, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.grow, .spacer { flex: 1; }
.muted { color: var(--fg-2); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app { display: flex; height: 100%; overflow: hidden; }
.side {
  width: 200px; flex: none; height: 100%;
  background: var(--bg-1); border-right: 1px solid var(--bd);
  display: flex; flex-direction: column; padding: 16px 10px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-badge {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: #111; overflow: hidden;
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px -3px color-mix(in srgb, var(--accent) 55%, transparent);
}
.brand-badge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-badge .ic { width: 18px; height: 18px; stroke-width: 2; }
.brand .t1 { font-size: 14px; font-weight: 700; }
.brand .t2 { font-size: 12px; color: var(--fg-2); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  border: 1px solid transparent; background: transparent; color: var(--fg-1);
  border-radius: 8px; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--bg-2); color: var(--fg); }
.nav-item.on { background: var(--accent-weak); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.nav-item .ic { width: 18px; height: 18px; }
.nav-item .kbd-hint { margin-left: auto; font-size: 11px; color: var(--fg-3); font-weight: 500; }
.nav-item.on .kbd-hint { color: color-mix(in srgb, var(--accent) 70%, transparent); }
.main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 52px; background: #f7f8fc; border-bottom: 1px solid var(--bd);
  display: flex; align-items: center; padding: 0 18px; gap: 8px;
  color: var(--fg-2); font-size: 13px;
}
.ic, svg.ic {
  width: 16px; height: 16px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico-btn, .btn.ghost.icon {
  width: 34px; height: 34px; padding: 7px; border: 1px solid var(--bd);
  background: #fff; border-radius: 8px; cursor: pointer; color: var(--fg-1);
}
.ico-btn:hover, .btn.ghost.icon:hover, .user-btn:hover { background: var(--bg-2); }
.user-menu { position: relative; }
.user-menu .drop-menu { left: auto; right: 0; width: 160px; }
.user-btn {
  height: 34px; border: 1px solid var(--bd); background: #fff; border-radius: 8px;
  padding: 0 12px; font-size: 13px; color: var(--fg); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.view { flex: 1; overflow: auto; overflow-x: hidden; padding: 18px 22px 28px; }
.view-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head h1 { margin: 0; font-size: 20px; font-weight: 650; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; margin: 4px 0 12px;
}
.section-title::before {
  content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--accent);
}
.section-title .count {
  margin-left: 8px; font-weight: 500; color: var(--fg-2); font-size: 12px;
  background: var(--bg-2); border-radius: 999px; padding: 1px 8px;
}

.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--bg-1); border: 1px solid var(--bd); border-radius: var(--r-3);
  padding: 12px 16px;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--bd-2); }
.card .k { font-size: 13px; color: var(--fg-2); }
.card .v { font-size: 26px; font-weight: 650; line-height: 1.15; margin-top: 7px; letter-spacing: -.5px; }
.card .v.up { color: var(--success); }
.card .v.info { color: var(--info); }
.card .v.down { color: var(--danger); }
.card .v.warn { color: var(--warning); }
.card .sub { font-size: 12px; color: var(--fg-2); margin-top: 2px; }
.stat-card { position: relative; }
.stat-card .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.stat-ic {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.stat-ic .ic { width: 17px; height: 17px; }
.icon-badge {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--accent-weak); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-badge .ic { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-2); border: 1px solid transparent;
  background: var(--bg-2); color: var(--fg); cursor: pointer;
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.btn:hover { filter: brightness(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #8f8ef7, #6d6cf0); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--bd); }
.btn.ghost:hover { background: var(--bg-2); }
.btn.ghost.on { background: var(--accent-weak); color: var(--accent); border-color: rgba(91,92,230,.28); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: var(--r-1); }
.btn.danger { color: var(--danger); background: transparent; border-color: var(--bd); }
.btn.danger:hover { background: var(--danger-weak); }
.btn.warn { background: #fff6e8; color: var(--warning); border: 1px solid #f0d9a8; }
.btn.gray { background: transparent; border-color: var(--bd); }
.btn.busy { opacity: .6; pointer-events: none; }

.input, select.input, textarea.input {
  background: var(--bg-1); color: var(--fg);
  border: 1px solid var(--bd); border-radius: var(--r-2);
  padding: 7px 10px; font-size: 13px;
}
.input.sm, select.input.sm { padding: 4px 8px; font-size: 12px; height: 32px; }
select.input { cursor: pointer; width: auto; }
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filterbar .toolbar { flex-wrap: nowrap; margin-left: auto; }
.filterbar .sep { width: 1px; height: 20px; background: var(--bd); }
.search { position: relative; display: inline-flex; align-items: center; }
.search .ic { position: absolute; left: 9px; color: var(--fg-3); pointer-events: none; width: 14px; height: 14px; }
.search .input, .search .input.sm { width: 200px; padding-left: 30px; }
.chip {
  padding: 4px 12px; border-radius: var(--r-full); border: 1px solid var(--bd);
  background: var(--bg-1); color: var(--fg-1); cursor: pointer; font-size: 12px; font-weight: 500;
}
.chip.auto.on { background: var(--accent-weak); color: var(--accent); border-color: rgba(91,92,230,.28); }
.chip.auto.on::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 5px; vertical-align: middle;
}
.datenav { display: inline-flex; align-items: center; gap: 4px; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: var(--bg-1); border: 1px solid var(--bd); border-radius: 8px; overflow: hidden; }
.seg-btn {
  height: 32px; border: 0; background: transparent; padding: 0 12px;
  font-size: 12px; cursor: pointer; color: var(--fg-1);
}
.seg-btn.on { background: var(--accent-weak); color: var(--accent); font-weight: 700; }

.panel {
  background: var(--bg-1); border: 1px solid var(--bd); border-radius: var(--r-3);
}
.panel.pad { padding: 14px 16px; }
.dropzone {
  border: 1.5px dashed var(--bd-2); border-radius: 12px; padding: 28px 16px;
  text-align: center; color: var(--fg-1); background: var(--bg-2);
}
.dropzone.over { border-color: var(--accent); background: var(--accent-weak); }
.dropzone .icon-badge { margin: 0 auto 10px; }
textarea.input { width: 100%; min-height: 220px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.6; background: var(--bg-2); }

.tbl-wrap { border: 1px solid var(--bd); border-radius: var(--r-3); overflow: hidden; background: var(--bg-1); }
.tbl-wrap.virt { display: flex; flex-direction: column; }
.tbl-virt { max-height: calc(100vh - 270px); overflow: auto; }
.tbl-virt thead th { position: sticky; top: 0; z-index: 2; }
.tbl-virt tbody tr:not(.virt-pad) { height: 56px; }
.tbl-virt tbody td { overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--bd); vertical-align: middle; }
.tbl td:last-child { white-space: nowrap; }
.tbl thead th { background: var(--bg-2); color: var(--fg-2); font-weight: 500; font-size: 12px; white-space: nowrap; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg-2); }
.tbl .tbl-check { width: 34px; text-align: center; padding-right: 0; }
.tbl input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.tbl-foot { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--bd); font-size: 12px; color: var(--fg-2); }
.tbl-sum {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 13px; margin-bottom: 8px; background: var(--bg-1);
  border: 1px solid var(--bd); border-radius: var(--r-2); font-size: 13px;
}
.tbl-sum.hidden { display: none; }
.tbl-sum .sum-k { color: var(--fg-2); margin-right: 5px; }
.sel-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--accent-weak); border: 1px solid rgba(91,92,230,.28);
  border-radius: var(--r-2); margin-bottom: 8px; font-size: 13px;
}
.st {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.st.pending { color: var(--st-pending); background: var(--st-pending-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-pending) 30%, transparent); }
.st.running { color: var(--st-processing); background: var(--st-processing-bg); }
.st.success { color: var(--st-completed); background: var(--st-completed-bg); }
.st.abnormal, .st.invalid, .st.expired { color: var(--st-failed); background: var(--st-failed-bg); }
.st.pt-sub { color: var(--st-completed); background: var(--st-completed-bg); }
.st.pt-add { color: #c47b12; background: #fff6e8; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--r-full);
  font-size: 12px; background: var(--bg-2); color: var(--fg-1); font-weight: 500;
}
.badge.exported {
  color: var(--st-exported); background: transparent;
  box-shadow: inset 0 0 0 1px rgba(124,92,191,.45); margin-left: 6px;
}
.row { display: flex; align-items: center; gap: 6px; }
.empty { text-align: center; padding: 48px 20px; color: var(--fg-2); }
.empty .big {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px;
  background: var(--bg-2); color: var(--fg-2);
  display: flex; align-items: center; justify-content: center;
}
.empty .big .ic { width: 26px; height: 26px; }
.empty h3 { margin: 0 0 6px; color: var(--fg); font-size: 16px; }
.empty .btn { margin-top: 12px; }

.menu-wrap { position: relative; }
.drop-menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: 220px;
  background: #fff; border: 1px solid var(--bd); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(31,35,72,.12); padding: 6px 0; z-index: 40;
}
.drop-menu .hd { padding: 6px 14px 4px; font-size: 12px; color: var(--fg-3); font-weight: 600; }
.drop-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--fg);
}
.drop-menu button:hover { background: var(--bg-2); }
.drop-menu .sep { height: 1px; background: var(--bd); margin: 4px 0; }

.toast {
  display: none; position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1f2330; color: #fff; padding: 8px 16px; border-radius: 8px; z-index: 80; font-size: 13px;
}
.mask {
  position: fixed; inset: 0; background: rgba(31,35,48,.35);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.mask.show { display: flex; }
.dialog {
  width: 420px; max-width: calc(100% - 32px); background: #fff; border-radius: 12px;
  box-shadow: 0 18px 48px rgba(31,35,72,.16); padding: 18px 18px 14px;
}
.dialog.wide { width: 560px; }
.dialog h3 { margin: 0 0 12px; font-size: 16px; }
.dialog .body { font-size: 13px; color: var(--fg-1); max-height: 60vh; overflow: auto; }
.dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog .kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; font-size: 13px; }
.dialog .kk { color: var(--fg-2); }
.dialog .qr { width: 180px; height: 180px; object-fit: contain; display: block; margin: 10px 0; }

.gate { min-height: 100%; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.gate-card {
  width: 420px; background: #fff; border-radius: 20px;
  box-shadow: 0 18px 48px rgba(31,35,72,.08); padding: 36px;
}
.gate-logo {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px;
  overflow: hidden; background: #111;
  display: flex; align-items: center; justify-content: center;
}
.gate-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gate-card h2 { margin: 0; text-align: center; font-size: 22px; }
.gate-sub { margin: 6px 0 24px; text-align: center; color: var(--fg-3); font-size: 13px; }
.gate-card label { display: block; font-size: 13px; color: var(--fg-2); margin-bottom: 6px; }
.gate-card .input { width: 100%; height: 42px; background: var(--bg-2); border: 0; }
.gate-card .btn { width: 100%; height: 42px; margin-top: 8px; }
.gate-msg { min-height: 20px; text-align: center; color: var(--danger); font-size: 13px; margin-top: 10px; }

.bars { height: 180px; display: flex; align-items: flex-end; gap: 6px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 40%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); }
.bar-col .d { font-size: 10px; color: var(--fg-3); margin-top: 4px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--fg-2); margin-top: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.legend .up { background: var(--accent); }
.legend .ok { background: var(--success); }
.legend .fail { background: var(--danger); }
.compact .tbl th, .compact .tbl td { padding: 5px 10px; }
.compact .card .v { font-size: 22px; }
.page.hidden { display: none !important; }
.drawer-mask { position: fixed; inset: 0; background: rgba(31,35,48,.2); z-index: 44; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw;
  background: #fff; border-left: 1px solid var(--bd);
  box-shadow: -12px 0 32px rgba(31,35,48,.12);
  z-index: 45; padding: 18px 20px; overflow: auto;
}
.drawer h3 { margin: 0 0 14px; font-size: 16px; display: flex; align-items: center; }
.drawer .kv { display: grid; grid-template-columns: 88px 1fr; gap: 10px 12px; font-size: 13px; }
.drawer .kk { color: var(--fg-2); }
.drawer .qr { width: 180px; height: 180px; object-fit: contain; display: block; margin: 8px 0; }
.field { margin-bottom: 14px; }
.pass-wrap { position: relative; }
.pass-wrap .eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--fg-2); cursor: pointer; font-size: 12px;
}
.btn.ghost.icon.sm { width: 32px; height: 32px; padding: 6px; }
html[data-theme="dark"] {
  --bg: #0a0d13; --bg-1: #10141c; --bg-2: #161b26; --bg-3: #1e2530;
  --bd: #262e3b; --bd-2: #333d4d; --fg: #e6edf3; --fg-1: #aeb9c7; --fg-2: #7a8798; --fg-3: #6b7280;
  --accent: #7d7cf3; --accent-weak: #20213f; --success: #3fb950; --success-weak: #0f2a19;
  --danger: #f45b5b; --danger-weak: #2a1416; --warning: #d99a2b; --info: #58a6ff;
  --st-completed: #3fb950; --st-completed-bg: #0f2a1a; --st-pending: #8b98a8; --st-pending-bg: #1a2029;
  --st-processing: #58a6ff; --st-processing-bg: #0f2137; --st-failed: #f45b5b; --st-failed-bg: #2a1416;
  --st-exported: #bc8cff;
  color-scheme: dark;
}
html[data-theme="dark"] .topbar, html[data-theme="dark"] .ico-btn, html[data-theme="dark"] .user-btn,
html[data-theme="dark"] .drop-menu, html[data-theme="dark"] .drawer, html[data-theme="dark"] .dialog {
  background: var(--bg-1); color: var(--fg); border-color: var(--bd);
}
