@font-face {
  font-family: Satoshi;
  src: url("fonts/Satoshi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Satoshi;
  src: url("fonts/Satoshi-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Satoshi;
  src: url("fonts/Satoshi-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --bg-soft: #f7f7f7;
  --line: #e8e8e8;
  --line-strong: #dedede;
  --text: #111111;
  --muted: #6b6b6b;
  --faint: #5c5c5c;
  --brand: #111111;
  --brand-2: #111111;
  --ink: #111111;
  --ink-hover: #2a2a2a;
  --on-ink: #ffffff;
  --accent: #a6c23f;
  --ok: #237804;
  --ok-bg: #f6ffed;
  --ok-line: #b7eb8f;
  --warn: #ad6800;
  --warn-bg: #fffbe6;
  --warn-line: #ffe58f;
  --err: #cf1322;
  --err-badge: #a8071a;
  --err-bg: #fff2f0;
  --err-line: #ffccc7;
  --busy: #0958d9;
  --busy-bg: #e6f4ff;
  --busy-line: #91caff;
  --stop: #595959;
  --stop-bg: #f4f4f5;
  --stop-line: #e9e9eb;
  --amber: #d48806;
  --green: #389e0d;
  --red: #ff4d4f;
  --violet: #111111;
  --shadow: 0 10px 28px rgba(17, 17, 17, 0.08);
  --scroll: #d4d4d4;
  --scroll-hover: #a6a6a6;
  --overlay: rgba(17, 17, 17, 0.28);
  --mark-frame: #fafafa;
  --wash-spot: #f7f7f7;
  --stage: #111111;
  --stage-mist: #d4d4d4;
  --stage-fg: #fafafa;
  --radius: 8px;
  --sidebar: 200px;
  --top: 48px;
  --sans: "Satoshi", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Satoshi", ui-monospace, "SF Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111111;
  --bg-elev: #1a1a1a;
  --bg-soft: #161616;
  --line: #2c2c2c;
  --line-strong: #3d3d3d;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #8a8a8a;
  --brand: #fafafa;
  --brand-2: #fafafa;
  --ink: #fafafa;
  --ink-hover: #e6e6e6;
  --on-ink: #111111;
  --ok: #73d13d;
  --ok-bg: #162312;
  --ok-line: #274916;
  --warn: #ffc53d;
  --warn-bg: #2b2111;
  --warn-line: #594214;
  --err: #ff7875;
  --err-badge: #a8071a;
  --err-bg: #2a1215;
  --err-line: #58181c;
  --busy: #69b1ff;
  --busy-bg: #111a2c;
  --busy-line: #15325b;
  --stop: #a6a6a6;
  --stop-bg: #1f1f1f;
  --stop-line: #3d3d3d;
  --amber: #ffc53d;
  --green: #73d13d;
  --red: #ff4d4f;
  --violet: #fafafa;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.48);
  --scroll: #3d3d3d;
  --scroll-hover: #5c5c5c;
  --overlay: rgba(0, 0, 0, 0.52);
  --mark-frame: #111111;
  --wash-spot: #1a1a1a;
  --stage: #0a0a0a;
  --stage-mist: #8a8a8a;
  --stage-fg: #f5f5f5;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html {
  color-scheme: light;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}
body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.01em;
  font-feature-settings: "tnum" 1;
}
/* 选中不要整块反黑，用橄榄色薄雾，文字颜色照旧 */
::selection { background: rgba(166, 194, 63, 0.38); }
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
input, textarea { caret-color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }

.app { min-height: 100vh; }
.app-shell {
  height: 100%;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body:has(.app-shell:not(.hidden)) {
  height: 100%;
  overflow: hidden;
}

.topbar {
  height: var(--top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  position: relative;
  flex-shrink: 0;
  z-index: 20;
}

.brand-cluster { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 14px;
}
.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  overflow: hidden;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.top-actions { display: flex; align-items: center; gap: 8px; }
.role-pill {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
}
.role-pill strong {
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.shell {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  align-self: stretch;
  padding: 16px 10px 24px 12px;
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) var(--bg-soft);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: var(--bg-soft); }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 8px;
  border: 2px solid var(--bg-soft);
  background-clip: padding-box;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
.nav-group {
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  margin: 16px 8px 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.nav-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.nav-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 500;
}
.nav-btn:hover { background: var(--bg-elev); color: var(--text); }
.nav-btn.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  position: relative;
}
.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: auto;
  bottom: 5px;
  height: 1px;
  width: auto;
  background: var(--accent);
  border-radius: 0;
}
.nav-btn .count {
  font-size: 11px;
  color: #ffffff;
  background: var(--err-badge);
  padding: 0 5px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 4px;
  font-weight: 500;
}
.nav-btn.active .count,
.nav-btn:hover .count {
  color: #ffffff;
  background: var(--err-badge);
}
.nav-btn .count:empty { display: none; }

.main {
  flex: 1;
  padding: 20px 24px 48px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}
.main::-webkit-scrollbar { width: 8px; height: 8px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.main::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
.view { display: none; }
.view.active { display: block; }

.sec-board {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.list-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 28px;
  flex-wrap: wrap;
}
.page-head h1,
.page-head h2 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-head p { margin: 0; color: var(--muted); font-size: 12px; max-width: 62ch; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
}
.tab-btn:hover { color: var(--text); border-color: var(--ink); }
.tab-btn.active {
  color: var(--on-ink);
  border-color: var(--ink);
  background: var(--ink);
}
.tab-btn .n { color: var(--accent); margin-left: 4px; }
.settings-tabs {
  display: flex;
  align-items: flex-end;
  gap: 26px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line-strong);
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms cubic-bezier(0.16, 1, 0.3, 1), border-color 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active {
  color: var(--text);
  border-bottom-color: var(--ink);
}
.settings-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.policy-media {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1.1fr);
  gap: 24px;
  align-items: start;
}
.policy-guide {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.policy-guide-block + .policy-guide-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.policy-guide h2,
.policy-guide h3 {
  margin: 0 0 8px;
}
.policy-guide h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.policy-guide h3 {
  font-size: 14px;
  font-weight: 700;
}
.policy-guide ol {
  margin: 0;
  padding-left: 1.15em;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.policy-guide li + li { margin-top: 6px; }
.policy-guide code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-variant-ligatures: none;
}
.policy-guide a { text-decoration: underline; text-underline-offset: 3px; }
.policy-guide .desk-meta { margin: 0 0 8px; }
.policy-guide .desk-meta:last-child { margin: 16px 0 0; }
.policy-cmd {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}
@media (max-width: 860px) {
  .policy-media,
  #v-policy .grid-2 { grid-template-columns: 1fr; }
}
.log-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 14px;
}
.log-tools .row { margin: 0; }
.log-kind,
.log-q {
  width: auto;
  min-width: 7.2em;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 32px;
  border-radius: 4px;
}
.log-q {
  width: 16em;
  min-width: 10em;
}
.log-kind:hover,
.log-q:hover { border-color: var(--ink); }
select.log-kind:focus,
select.log-kind:focus-visible {
  outline: 0;
  outline-offset: 0;
  border-color: var(--ink);
  box-shadow: none;
}
.log-tools .log-export { margin-left: auto; }
.log-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 0;
}
.log-date .input {
  width: 9.8em;
  min-width: 0;
  padding: 4px 8px;
  font-size: 12px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}
.pager-total { margin-right: 4px; }
.pager-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  color: var(--muted);
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 4px;
  border: none;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 32px;
}
.pager-btn:hover:not(:disabled):not(.is-active) { color: var(--ink); }
.pager-btn.is-active {
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 700;
  cursor: default;
}
.pager-btn:disabled {
  color: var(--faint);
  background: var(--bg-soft);
  cursor: not-allowed;
}
.relay-pick { margin: 0 0 14px; }
.relay-pick-label { margin: 0 0 6px; font-size: 12px; color: var(--text); font-weight: 500; }
.relay-pick .tabs { margin-bottom: 10px; }
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-elev);
}
.msg.admin,
.msg.tenant { border-left: 1px solid var(--line-strong); }
.msg-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.msg-body { white-space: pre-wrap; line-height: 1.6; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
td.row {
  display: table-cell;
  white-space: nowrap;
  vertical-align: middle;
}
td.row > * + * { margin-left: 8px; }

/* 表格操作列：只排实际按钮，间距与 td.row 一致 */
.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.col-check {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}
.col-check input {
  margin: 0;
  vertical-align: middle;
}

.btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: background 180ms cubic-bezier(0.16, 1, 0.3, 1), border-color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
a.btn { display: inline-block; }
.btn:hover, a.btn:hover { background: var(--bg-soft); border-color: var(--scroll-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  position: relative;
  padding-left: 22px;
}
.btn-primary::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--accent);
}
.btn-primary:hover { filter: none; background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-primary.is-loading::after {
  width: 8px;
  height: 8px;
  margin-top: -4px;
  box-sizing: border-box;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-right-color: transparent;
  animation: btn-spin 0.7s linear infinite;
}
.btn:not(.btn-primary).is-loading {
  position: relative;
  padding-left: 22px;
}
.btn:not(.btn-primary).is-loading::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-amber {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-danger {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-danger:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.btn-sm.btn-primary { padding-left: 18px; padding-right: 8px; }
.btn-sm.btn-primary::after { left: 7px; width: 5px; height: 5px; margin-top: -2.5px; }

.theme-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  border-radius: 6px;
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.theme-toggle:hover { background: var(--bg-soft); border-color: var(--scroll-hover); }
.theme-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}
.theme-toggle .theme-icon-moon { display: block; }
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }

.grid { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.claims {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  overflow: hidden;
}
.claim {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 16px 18px 18px;
  border-right: 1px solid var(--line);
  color: inherit;
  min-width: 0;
  position: relative;
}
.claim:last-child { border-right: 0; }
.claim:hover { background: var(--bg); }
.claim.is-on { box-shadow: none; }
.claim.is-on::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 8px;
  height: 2px;
  background: var(--accent);
}
.claim-k {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.claim-v {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}
.claim-s { display: block; color: var(--faint); font-size: 12px; }

.proof {
  margin: 0 0 36px;
  padding: 14px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
  .sidebar { transition: none; }
  .toast { animation: none; }
  .toast-job.is-busy .job-bar > i { animation: none; transform: scaleX(0.4); }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: none;
}
.card:not(.table-wrap) {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card.table-wrap {
  display: block;
  padding: 16px 16px 0;
}
.card > h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card.table-wrap > h2 { margin: 0 0 12px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v {
  font-size: 20px;
  font-weight: 700;
  margin: 6px 0 2px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stat .s { color: var(--faint); font-size: 12px; }

.table-wrap { overflow: auto; }
table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 9px 8px 9px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:last-child td,
tbody tr:last-child th { border-bottom: 0; }
td.mono, .mono {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-weight: 500;
}
.tag::before { content: none; }
.tag-run, .tag-ok {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-bg);
}
.tag-stop {
  color: var(--stop);
  border-color: var(--stop-line);
  background: var(--stop-bg);
}
.tag-busy {
  color: var(--busy);
  border-color: var(--busy-line);
  background: var(--busy-bg);
}
.tag-warn {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}
.tag-err {
  color: var(--err);
  border-color: var(--err-line);
  background: var(--err-bg);
}

.input, select, textarea {
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 10px;
  outline: none;
  font-weight: 400;
  color: var(--text);
}
textarea.input {
  min-height: 4.5em;
  resize: vertical;
  line-height: 1.45;
  white-space: pre;
}
.input:focus, select:focus, textarea:focus,
.input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(166, 194, 63, 0.30);
}
select.pager-sizes {
  width: auto;
  min-width: 6.8em;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
}
select.pager-sizes:hover { border-color: var(--ink); }
select.pager-sizes:focus,
select.pager-sizes:focus-visible {
  outline: 0;
  outline-offset: 0;
  border-color: var(--ink);
  box-shadow: none;
}
.input::placeholder { color: var(--faint); }
.field {
  display: grid;
  gap: 5px;
  align-content: start;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 500;
  min-width: 0;
  overflow: visible;
}
.field > span { line-height: 1.45; overflow: visible; }
.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-items: start;
}
.select-multi {
  position: relative;
  z-index: 0;
  min-width: 0;
}
.select-multi.is-open {
  z-index: 5;
}
button.select-multi-btn {
  width: 100%;
  min-height: 34px;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-weight: 400;
  padding-right: 28px;
  background-color: var(--bg-elev);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235c5c5c' d='M1.2 1.4L6 6.2l4.8-4.8'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.select-multi-btn:disabled {
  cursor: default;
  color: var(--faint);
}
.select-multi.is-open .select-multi-btn {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(166, 194, 63, 0.30);
}
.select-multi-menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  bottom: auto;
  max-height: 196px;
  overflow: auto;
  padding: 4px 0;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.select-multi-opt {
  display: block;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}
.select-multi-opt:hover {
  background: var(--bg-soft);
}
.select-multi-opt.is-on {
  background: var(--bg-soft);
  font-weight: 500;
}
.select-multi-opt.is-on::after {
  content: "✓";
  float: right;
  color: var(--muted);
  font-weight: 500;
}
.period-list { display: grid; gap: 8px; }
.period-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}
.period-row-trial { grid-template-columns: 110px 72px 24px 1fr; }
.period-row-trial .period-unit {
  display: flex;
  align-items: center;
  color: var(--muted, #6b7280);
  font-size: 13px;
}
.period-row span { display: flex; align-items: center; gap: 8px; }
.input[readonly] { color: var(--muted); background: var(--bg-soft); }

.desk-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}
.desk-top { display: flex; justify-content: space-between; gap: 10px; }
.desk-title { font-weight: 700; font-size: 14px; }
.desk-meta { color: var(--muted); font-size: 12px; line-height: 1.6; }
.desk-label-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  width: max-content;
  max-width: 100%;
}
.remark-edit-button {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
  vertical-align: baseline;
  transform: translateY(2px);
}
.remark-edit-button:hover {
  color: var(--text);
}
.remark-edit-button svg { display: block; }
.remark-edit-button:focus-visible {
  outline: none;
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(166, 194, 63, 0.30);
}
.desk-remark-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.desk-remark-form .input {
  width: 190px;
  min-width: 150px;
  height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}
.money {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.buy-price {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  font-weight: 400;
}
.buy-price .money {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 4px 8px; font-size: 12px; }
.kv span { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.toast-wrap {
  position: fixed;
  top: calc(var(--top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
  min-width: min(360px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow), 0 10px 28px rgba(17, 17, 17, 0.10);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  /* 校验值、收款地址这类长串没有空格，不断行就会顶出屏幕 */
  overflow-wrap: anywhere;
  word-break: break-word;
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.copy-fallback {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  resize: none;
}
.toast b {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.toast-err {
  background: var(--err-bg);
  border-color: var(--err-line);
}
.toast-err b { color: var(--err); }
.toast-job .job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.toast-job .job-head b { margin-bottom: 0; }
.toast-job .job-msg { color: var(--muted); }
.toast-job .job-bar {
  height: 4px;
  margin-top: 10px;
  background: var(--line);
  overflow: hidden;
}
.toast-job .job-bar > i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: var(--ink);
  transition: transform 0.4s ease;
}
.toast-job.is-busy .job-bar > i {
  animation: job-forward 90s linear forwards;
}
@keyframes job-forward {
  from { transform: scaleX(0.08); }
  to { transform: scaleX(0.9); }
}
.toast-job.toast-err .job-bar > i { background: var(--err); }

.modal-mask {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 20px;
}
.modal-mask.show { display: flex; }
#confirm-modal { z-index: 80; }
.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.modal-lg { width: min(860px, 100%); }
.modal-auth { width: min(480px, 100%); }
.modal header, .modal footer { padding: 12px 16px; flex-shrink: 0; }
.modal header { border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; font-size: 17px; font-weight: 700; }
.modal .body {
  position: relative;
  z-index: 1;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}
.modal .body > * {
  flex-shrink: 0;
}
.modal footer { border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 480px at 50% -8%, var(--wash-spot), transparent 58%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  min-width: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 24px 20px;
  box-shadow: none;
}
.login-card h1 { margin: 10px 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.login-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
}
.login-card .stack > .btn { width: 100%; }
.login-bind-card { width: min(440px, 100%); }
.login-bind-card .qr-bind { margin-bottom: 4px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.totp-input { letter-spacing: 0.28em; font-family: var(--mono); text-align: center; }
.qr-bind {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
}
.qr-box {
  width: 120px;
  height: 120px;
  flex: 0 0 120px;
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.qr-box:empty {
  background: var(--ink);
  box-shadow: inset 0 0 0 8px var(--bg-elev);
}
.qr-box img {
  display: block;
  width: 120px;
  height: 120px;
}
.qr-bind .desk-meta { margin: 0; }

.line-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.bar {
  height: 2px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
  margin-top: 6px;
}
.bar > i { display: block; height: 100%; background: var(--ink); }

.hidden, .feat-off { display: none !important; }

/* 刷新时先不画登录页，等 /api/me 有结果再决定。
   spinner 延迟淡入，会话恢复够快时用户看不到任何中间态。 */
body.session-checking > #login-screen,
body.session-checking > #login-bind-screen,
body.session-checking > .app-shell { visibility: hidden; }
body.session-checking::after {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  opacity: 0;
  animation: session-spin 0.7s linear infinite, session-fade 0.2s ease-out 0.45s forwards;
}
@keyframes session-spin { to { transform: rotate(360deg); } }
@keyframes session-fade { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  body.session-checking::after { animation: session-fade 0.2s ease-out 0.45s forwards; }
  .btn.is-loading::after { animation: none; opacity: 0.55; }
  .btn-primary.is-loading::after { border-right-color: var(--accent); }
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}
.live-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: none;
}
.live-stage {
  position: relative;
  width: 100%;
  height: min(62vh, 640px);
  border-radius: 8px;
  background: var(--stage);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--stage-mist);
  text-align: center;
  overflow: hidden;
}
.live-stage b { color: var(--stage-fg); font-size: 14px; }
.live-stage .live-frame {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--stage);
  image-rendering: auto;
  will-change: contents;
}
.live-stage.has-frame .live-frame { display: block; }
.live-stage.has-frame .live-placeholder { display: none; }
.live-stage .live-dot {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--stage-fg);
  background: rgba(17, 17, 17, 0.72);
}
.live-stage .live-rec {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--stage-fg);
  background: rgba(17, 17, 17, 0.72);
}
.live-stage .live-rec:empty { display: none; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.demo-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.demo-switch a {
  color: var(--muted);
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 6px;
  text-decoration: none;
}
.demo-switch a:hover, .demo-switch a.here { color: var(--text); background: var(--bg-soft); }

.proof-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}
.proof-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.queue {
  margin: 8px 0 0;
  padding: 14px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}

.nav-toggle {
  display: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  border-radius: 6px;
  position: relative;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}
.nav-toggle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
  transform: translate(-50%, -50%);
  box-shadow: 0 -5px 0 var(--ink), 0 5px 0 var(--ink);
}
.nav-toggle::after { display: none; }
.nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 25;
}

@media (max-width: 1100px) {
  .grid-4, .claims { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .topbar {
    height: auto;
    min-height: var(--top);
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(240px, 86vw);
    flex: none;
    transform: translateX(-100%);
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    overflow: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-scrim { display: block; }
  .claim { border-bottom: 1px solid var(--line); padding-right: 12px; }
  .claim:nth-child(2n) { border-right: 0; padding-right: 0; }
}

@media (max-width: 480px) {
  .login { padding: 16px 14px; }
  .main { padding: 16px 14px 40px; }
  .page-head { align-items: flex-start; }
  .field-row { grid-template-columns: 1fr; }
  .demo-switch { flex-wrap: wrap; }
  .toast-wrap {
    width: calc(100vw - 24px);
    min-width: calc(100vw - 24px);
  }
}

.rec-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}
.rec-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: none;
}

.player {
  width: 100%;
  height: 320px;
  border-radius: 8px;
  background: var(--stage);
  border: 1px solid var(--line);
  object-fit: contain;
}
.cdn-url {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
.pay-addr {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px dashed var(--line-strong);
  background: var(--bg-soft);
}
.pay-amount {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.pick-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}
.pick-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
}
.pick-item:last-child { border-bottom: 0; }
.pick-item b { font-weight: 650; }
.pick-item .desk-meta { margin: 2px 0 0; }
.pick-item input { margin-top: 3px; flex: none; }
.pick-item:has(input:checked) { background: var(--bg-soft); }
.pick-item:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.match-search .input { flex: 1; min-width: 12rem; }
.settle-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  overflow: hidden;
}
.settle-stats .claim {
  border-right: 1px solid var(--line);
  border-bottom: 0;
  padding: 16px 18px 18px;
}
.settle-stats .claim:last-child { border-right: 0; }
.settle-stats .claim:hover { background: transparent; }
.settle-stats + .settle-stats {
  margin-top: -1px;
  border-radius: 0 0 8px 8px;
}
.settle-stats:has(+ .settle-stats) {
  margin-bottom: 0;
  border-radius: 8px 8px 0 0;
}
#v-partner-bills .card + .card { margin-top: 12px; }
@media (max-width: 1100px) {
  body[data-role="partner"] .nav-btn { min-height: 44px; }
  body[data-role="partner"] .nav-toggle,
  body[data-role="partner"] .theme-toggle,
  body[data-role="partner"] .top-actions .btn { min-width: 44px; min-height: 44px; }
}
@media (max-width: 860px) {
  .settle-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settle-stats .claim { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .settle-stats .claim:nth-child(2n) { border-right: 0; }
  .settle-stats .claim:nth-last-child(-n + 2) { border-bottom: 0; }
}
