:root {
  --primary: #4f8cff;
  --primary-d: #2f6bf0;
  --ink: #1d2230;
  --ink-2: #59617a;
  --ink-3: #98a0af;
  --glass: rgba(255, 255, 255, 0.5);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --line: rgba(120, 140, 180, 0.22);
  --success: #168457;
  --success-soft: rgba(214, 245, 232, 0.85);
  --warning: #9a6411;
  --warning-soft: rgba(255, 244, 216, 0.9);
  --danger: #c33c45;
  --danger-soft: rgba(255, 230, 232, 0.9);
  --focus: rgba(79, 140, 255, 0.22);
  --shadow: 0 18px 50px rgba(50, 69, 108, 0.14);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #e8ecf5;
  position: relative;
  overflow-x: hidden;
}

/* ===== 流线极光背景（与控制台一致） ===== */
body::before {
  content: '';
  position: fixed;
  inset: -10%;
  z-index: -2;
  background:
    radial-gradient(640px 520px at 12% 8%, rgba(110, 145, 255, 0.6), transparent 65%),
    radial-gradient(720px 620px at 88% 18%, rgba(255, 150, 200, 0.45), transparent 65%),
    radial-gradient(680px 580px at 78% 88%, rgba(100, 220, 255, 0.5), transparent 65%),
    radial-gradient(520px 470px at 18% 85%, rgba(150, 255, 205, 0.45), transparent 65%),
    linear-gradient(160deg, #eef1f8, #e4e9f4);
  animation: aurora 26s ease-in-out infinite alternate;
}
body::after {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background: conic-gradient(from 120deg at 50% 40%, transparent 0deg, rgba(120, 160, 255, 0.08) 90deg, transparent 180deg, rgba(255, 170, 210, 0.07) 270deg, transparent 360deg);
  animation: swirl 40s linear infinite;
}
@keyframes aurora {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-2%, 1.5%) scale(1.04); }
  100% { transform: translate(2%, -1.5%) scale(1.02); }
}
@keyframes swirl { to { transform: rotate(360deg); } }

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--primary-d);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

/* ===== 登录页 ===== */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(420px, 100%);
  padding: 36px;
  border-radius: 20px;
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #4f8cff, #6a5cff);
  font-weight: 760;
  font-size: 22px;
  box-shadow: 0 8px 20px rgba(79, 140, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
.login-panel h1 { margin: 24px 0 8px; font-size: 25px; letter-spacing: -0.02em; }
.login-panel > p { margin: 0 0 28px; color: var(--ink-2); line-height: 1.65; }
.login-panel form { display: grid; gap: 10px; }

label, legend { font-size: 13px; font-weight: 650; color: #39445a; }
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(140, 160, 200, 0.4);
  border-radius: 12px;
  padding: 10px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input::placeholder { color: var(--ink-3); }
input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); background: #fff; }
input:disabled, input:read-only:not(.cal-input) { color: var(--ink-2); background: rgba(240, 244, 250, 0.8); }
input.cal-input { cursor: pointer; }

.domain-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(244, 247, 252, 0.72);
}
.domain-preview > div { min-width: 0; padding: 12px 14px; }
.domain-preview > div + div { border-inline-start: 1px solid var(--line); }
.domain-preview span { display: block; margin-bottom: 4px; color: var(--ink-3); font-size: 11px; }
.domain-preview output {
  display: block;
  overflow: hidden;
  color: var(--ink-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.domain-preview.ready output { color: #285fae; }

.primary, .quiet, .text-button, .license-action {
  min-height: 44px;
  border-radius: 12px;
  border: 0;
  padding: 9px 16px;
  font-weight: 650;
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.primary {
  color: #fff;
  background: linear-gradient(135deg, #4f8cff, #6a5cff);
  box-shadow: 0 6px 16px rgba(79, 140, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.primary:hover:not(:disabled) { box-shadow: 0 9px 24px rgba(79, 140, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25); transform: translateY(-1px); }
.quiet {
  color: #354159;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--glass-border);
}
.quiet:hover { background: rgba(255, 255, 255, 0.9); border-color: rgba(140, 160, 200, 0.5); }
.wide { width: 100%; }
.form-error, .aside-error { min-height: 20px; margin: 4px 0 0; color: var(--danger); font-size: 13px; line-height: 1.5; }

/* ===== 顶栏 ===== */
.topbar {
  height: 70px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand-lockup, .topbar-actions, .section-heading, .aside-heading, .form-actions { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-lockup h1 { margin: 0; font-size: 16px; }
.brand-lockup p { margin: 3px 0 0; color: var(--ink-3); font-size: 12px; }
.topbar-actions { gap: 16px; }
.service-state { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 13px; font-weight: 650; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: #24ae77; box-shadow: 0 0 0 4px rgba(36, 174, 119, 0.12); }

/* ===== 主区卡片 ===== */
.content { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 48px; }
.card {
  border-radius: 20px;
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.8fr);
  overflow: hidden;
}
.form-side { padding: 28px 32px 32px; }
.verification-side { padding: 28px; background: rgba(240, 244, 251, 0.55); border-left: 1px solid var(--line); }
.section-heading { justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading h2, .aside-heading h2 { margin: 0; font-size: 19px; letter-spacing: -0.015em; }
.section-heading p { margin: 7px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.privacy-note { flex: none; color: var(--success); background: var(--success-soft); padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.optional-label { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.credential-hint { display: block; margin-top: 7px; color: var(--ink-3); line-height: 1.55; }
.credential-hint.saved { color: var(--success); font-weight: 650; }
.credential-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.credential-row .credential-hint { flex: 1; }
.inline-danger {
  flex: none;
  border: 0;
  padding: 4px 0;
  color: var(--danger);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.inline-danger:hover { color: #9f2632; }
.inline-danger:focus-visible { outline: 3px solid rgba(208, 61, 76, 0.2); outline-offset: 3px; }

fieldset { margin: 0; padding: 0; border: 0; }
fieldset + fieldset { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
legend { margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { min-width: 0; position: relative; }
.field label { display: block; margin-bottom: 7px; }
.field small { display: block; margin-top: 7px; color: var(--ink-3); font-size: 12px; line-height: 1.55; }
.span-two { grid-column: span 2; }
.server-grid { grid-template-columns: minmax(0, 1.4fr) minmax(120px, 0.6fr); }
.form-actions { gap: 16px; margin-top: 28px; }
.form-actions .primary { min-width: 230px; }
.form-actions > span { color: var(--ink-3); font-size: 12px; line-height: 1.45; }

/* ===== 控制台同款小日历 ===== */
.cal-pop {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 80;
  box-sizing: border-box;
  width: 248px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 32px rgba(40, 60, 120, 0.22);
  transform: translateX(var(--cal-shift-x, 0px));
}
.cal-pop.open { display: block; }
.cal-pop[data-placement="top"] { top: auto; bottom: calc(100% + 6px); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 13px; font-weight: 600; }
.calNav {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.8);
  user-select: none;
}
.calNav:hover { background: rgba(255, 255, 255, 0.9); color: var(--primary-d); }
.calWk { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 10px; color: var(--ink-3); margin-bottom: 4px; }
.calGrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.calGrid .cd { aspect-ratio: 1; min-height: 0; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; border-radius: 9px; }
.calGrid .cd.on {
  cursor: pointer;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  font-weight: 500;
  transition: all 0.12s ease;
}
.calGrid .cd.on:hover { background: var(--primary); color: #fff; transform: scale(1.08); }
.calGrid .cd.off { color: rgba(150, 158, 175, 0.45); cursor: default; }
.calGrid .cd.today { box-shadow: inset 0 0 0 1.5px rgba(79, 140, 255, 0.55); }
.calGrid .cd.sel { background: linear-gradient(135deg, #4f8cff, #6a5cff) !important; color: #fff !important; font-weight: 600; }

/* ===== 核验侧栏 ===== */
.aside-heading { justify-content: space-between; gap: 12px; }
.status { padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.status.neutral { color: var(--ink-2); background: rgba(231, 235, 242, 0.9); }
.status.checking { color: var(--warning); background: var(--warning-soft); }
.status.ready, .status.success { color: var(--success); background: var(--success-soft); }
.status.failed { color: var(--danger); background: var(--danger-soft); }

.verification-empty { min-height: 360px; display: grid; align-content: center; justify-items: center; text-align: center; color: var(--ink-2); }
.verification-empty p { max-width: 28ch; margin: 20px 0 0; font-size: 13px; line-height: 1.65; }
.server-glyph { width: 82px; padding: 12px; display: grid; gap: 7px; border-radius: 14px; background: rgba(210, 220, 238, 0.7); }
.server-glyph span { height: 8px; border-radius: 4px; background: #8796af; }
.server-glyph span::after { content: ""; display: block; width: 6px; height: 6px; margin: 1px 0 0 4px; border-radius: 50%; background: var(--primary); }

.fingerprint-panel, .progress-panel, .success-panel { margin-top: 24px; }
.host-facts, .result-list { margin: 0; }
.host-facts > div, .result-list > div { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--ink-3); font-size: 12px; }
dd { margin: 0; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.fingerprint { margin: 20px 0 14px; padding: 14px; border-radius: 12px; background: rgba(228, 234, 244, 0.8); }
.fingerprint span { display: block; margin-bottom: 8px; color: var(--ink-2); font-size: 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.confirm-line { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0; line-height: 1.5; cursor: pointer; }
.confirm-line input { flex: none; width: 17px; min-height: 17px; margin-top: 2px; accent-color: var(--primary); }
.text-button { width: 100%; margin-top: 8px; color: var(--primary-d); background: transparent; }
.text-button:hover { background: rgba(79, 140, 255, 0.1); }

.progress-panel ol { list-style: none; margin: 0; padding: 0; }
.progress-panel li { position: relative; padding: 0 0 18px 30px; color: var(--ink-3); font-size: 13px; }
.progress-panel li::before { content: ""; position: absolute; left: 3px; top: 2px; width: 12px; height: 12px; border: 2px solid #a8b3c5; border-radius: 50%; background: #f3f6fb; }
.progress-panel li::after { content: ""; position: absolute; left: 10px; top: 17px; bottom: 1px; width: 1px; background: #cbd3e1; }
.progress-panel li:last-child::after { display: none; }
.progress-panel li.active { color: var(--primary-d); font-weight: 650; }
.progress-panel li.active::before { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.progress-panel li.done { color: var(--success); }
.progress-panel li.done::before { content: "✓"; display: grid; place-items: center; width: 16px; height: 16px; left: 1px; top: 0; border: 0; color: #fff; background: var(--success); font-size: 10px; }
.progress-message { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; }

.success-panel { text-align: center; }
.success-mark { width: 46px; height: 46px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-size: 24px; }
.success-panel h3 { margin: 0 0 8px; font-size: 18px; }
.success-panel > p { margin: 0 0 18px; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.result-list { text-align: left; margin-bottom: 18px; }
.success-panel > .result-note {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #37634f;
  background: var(--success-soft);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}
.aside-error { margin-top: 16px; }

.diagnostic-error {
  margin-top: 24px;
  padding: 18px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  color: #762d35;
  background: #fff4f4;
  border: 1px solid #efc7cb;
  border-radius: 14px;
}
.diagnostic-symbol {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--danger);
  font-size: 18px;
  font-weight: 750;
}
.diagnostic-content { min-width: 0; }
.diagnostic-content h3 { margin: 1px 0 6px; color: #67252c; font-size: 15px; letter-spacing: -0.01em; }
.diagnostic-content > p { margin: 0; color: #7f3f46; font-size: 13px; line-height: 1.6; }
.diagnostic-facts { margin: 14px 0 0; padding: 10px 12px; background: rgba(255, 255, 255, 0.72); border-radius: 10px; }
.diagnostic-facts > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 4px 0; }
.diagnostic-facts dt { color: #936168; }
.diagnostic-facts dd { color: #5f2f35; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.diagnostic-log {
  margin: 10px 0 0;
  padding: 11px 12px;
  max-height: 176px;
  overflow: auto;
  border: 1px solid #edd5d8;
  border-radius: 10px;
  color: #62383d;
  background: #fffafa;
  font: 11.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.diagnostic-actions { margin: 13px 0 0; padding-left: 18px; color: #6f3a40; font-size: 12.5px; line-height: 1.65; }
.diagnostic-actions li + li { margin-top: 3px; }
.diagnostic-retry { margin-top: 14px; width: 100%; color: #67252c; background: #fff; border-color: #e8b9be; }
.diagnostic-retry:hover { background: #fffafa; border-color: #da989f; }

/* ===== 商业包管理与推送更新 ===== */
.package-card { margin-top: 24px; padding: 26px 28px; }
.package-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; }
.package-block h3 { margin: 0 0 6px; font-size: 15px; }
.package-block > p { margin: 0 0 16px; color: var(--ink-2); font-size: 12.5px; line-height: 1.55; }
.package-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.package-block + .package-block { padding-left: 28px; border-left: 1px solid var(--line); }
.package-facts { margin: 0 0 16px; }
.package-facts > div { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.package-facts > div:last-child { border-bottom: 0; }
.file-row { display: flex; gap: 10px; align-items: center; margin-top: auto; padding-top: 16px; }
.file-row .quiet { flex: none; }
.file-name { flex: 1; min-width: 0; color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.package-block .form-actions { margin-top: 14px; }
.package-block .form-actions .primary { width: 100%; min-width: 0; }
.update-form { display: grid; gap: 14px; flex: 1; }
.update-form .form-actions.compact { margin-top: auto; padding-top: 4px; }
#updateProbeButton { width: 100%; }
.update-form .field label { display: block; margin-bottom: 7px; }
.update-target { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(110px, 0.5fr) minmax(120px, 0.7fr); gap: 12px; }
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(140, 160, 200, 0.4);
  border-radius: 12px;
  padding: 10px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
}
select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.update-verify { padding: 14px; border-radius: 12px; background: rgba(228, 234, 244, 0.8); }
.update-verify .fingerprint { margin: 0; padding: 0; background: transparent; }
.update-log {
  margin: 0;
  padding: 12px 14px;
  max-height: 180px;
  overflow-y: auto;
  border-radius: 12px;
  background: rgba(29, 34, 48, 0.88);
  color: #c8d2e4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ===== 客户远程管理 ===== */
.access-card { margin-top: 24px; padding: 26px 28px; }
.access-grid { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr); gap: 28px; }
.access-fields { display: grid; align-content: start; gap: 14px; }
.access-ssh-grid { grid-template-columns: minmax(100px, 0.7fr) minmax(130px, 1fr); }
.access-actions {
  min-width: 0;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}
.access-identity {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1.55fr);
  gap: 12px;
  margin-bottom: 14px;
}
.access-identity > div { min-width: 0; padding: 12px 14px; border-radius: 12px; background: rgba(235, 240, 248, 0.76); }
.access-identity span { display: block; margin-bottom: 4px; color: var(--ink-3); font-size: 11px; }
.access-identity strong, .access-identity code { display: block; overflow-wrap: anywhere; }
.password-editor { margin-top: 16px; }
.password-editor .primary { margin-top: 14px; }
.lock-editor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 15px 16px;
  border: 1px solid rgba(199, 66, 74, 0.2);
  border-radius: 12px;
  background: rgba(255, 245, 245, 0.72);
}
.lock-editor p { margin: 4px 0 0; color: var(--ink-2); font-size: 12px; line-height: 1.55; }
.danger-action { flex: none; min-height: 44px; color: #fff; background: var(--danger); }
.danger-action:hover { filter: brightness(0.94); }
.danger-action.unlock { color: #155d45; background: rgba(209, 242, 229, 0.95); }
.ledger-tools { display: flex; align-items: center; gap: 8px; }
.danger-text { color: var(--danger); }

/* ===== 授权账本 ===== */
.ledger { margin-top: 24px; padding: 26px 28px; }
.ledger-heading { margin-bottom: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; color: var(--ink-3); font-weight: 600; text-align: left; background: rgba(240, 244, 250, 0.8); white-space: nowrap; }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.customer-name { display: block; font-weight: 680; }
.license-id { display: block; margin-top: 4px; color: var(--ink-3); font-family: ui-monospace, monospace; font-size: 11px; }
.license-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.license-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.license-status.active { color: var(--success); }
.license-status.locked { color: #b66b00; }
.license-status.revoked { color: var(--danger); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.license-action { min-height: 34px; padding: 6px 10px; color: #3b4860; background: rgba(238, 242, 248, 0.9); font-size: 12px; white-space: nowrap; }
.license-action:hover { background: rgba(223, 230, 241, 0.95); }
.license-action.danger { color: var(--danger); background: var(--danger-soft); }
.table-loading, .table-empty { padding: 40px 16px; color: var(--ink-2); text-align: center; font-size: 13px; }

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 36px));
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: rgba(29, 34, 48, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(24, 33, 52, 0.28);
  transform: translateY(-14px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .workspace, .package-grid, .access-grid { grid-template-columns: 1fr; }
  .verification-side { border-left: 0; border-top: 1px solid var(--line); }
  .verification-empty { min-height: 220px; }
  .package-block + .package-block { padding-left: 0; border-left: 0; padding-top: 24px; border-top: 1px solid var(--line); }
  .access-actions { padding-left: 0; padding-top: 24px; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .topbar { height: auto; min-height: 66px; padding: 12px 16px; }
  .service-state { display: none; }
  .content { width: calc(100% - 24px); padding-top: 12px; }
  .form-side, .verification-side, .ledger, .package-card, .access-card { padding: 20px 16px; }
  .section-heading { align-items: flex-start; margin-bottom: 22px; }
  .privacy-note { display: none; }
  .field-grid, .server-grid, .update-target { grid-template-columns: 1fr; }
  .domain-preview { grid-template-columns: 1fr; }
  .domain-preview > div + div { border-inline-start: 0; border-top: 1px solid var(--line); }
  .span-two { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .primary { width: 100%; min-width: 0; }
  .ledger, .package-card, .access-card { margin-top: 12px; }
  .ledger-heading { align-items: center; }
  .ledger-tools { align-items: stretch; flex-direction: column-reverse; }
  .access-identity { grid-template-columns: 1fr; }
  .credential-row { align-items: flex-start; flex-direction: column; gap: 4px; }
  .lock-editor { align-items: stretch; flex-direction: column; }
  .danger-action { width: 100%; }
  .row-actions { justify-content: flex-start; }
  .login-panel { padding: 28px 22px; }
  .diagnostic-error { grid-template-columns: 1fr; padding: 16px; }
  .diagnostic-facts > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation: none !important; }
}

/* ===== 明暗主题 ===== */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
.login-panel { position: relative; }
.login-theme-toggle { position: absolute; top: 18px; right: 18px; }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f8fc;
  --ink-2: #b8c8da;
  --ink-3: #8ca2b9;
  --glass: rgba(13, 27, 44, 0.82);
  --glass-strong: rgba(18, 35, 56, 0.94);
  --glass-border: rgba(139, 183, 255, 0.2);
  --line: rgba(139, 183, 255, 0.16);
  --success: #62d9a2;
  --success-soft: rgba(75, 209, 144, 0.14);
  --warning: #f4bd62;
  --warning-soft: rgba(244, 189, 98, 0.14);
  --danger: #ff818b;
  --danger-soft: rgba(255, 111, 121, 0.14);
  --focus: rgba(139, 183, 255, 0.55);
  --shadow: 0 22px 52px rgba(0, 0, 0, 0.38);
}
html[data-theme="dark"] body { background: #071323; }
html[data-theme="dark"] body::before { background: radial-gradient(680px 520px at 12% 8%, rgba(47, 115, 237, 0.28), transparent 66%), radial-gradient(700px 620px at 88% 18%, rgba(76, 141, 255, 0.13), transparent 68%), radial-gradient(620px 560px at 78% 88%, rgba(31, 170, 201, 0.12), transparent 68%), linear-gradient(160deg, #040b14, #071323 55%, #0b1b2c); }
html[data-theme="dark"] body::after { background: conic-gradient(from 120deg at 50% 40%, transparent, rgba(76, 141, 255, 0.07), transparent 48%, rgba(75, 209, 144, 0.04), transparent); }
html[data-theme="dark"] .topbar { background: rgba(7, 19, 35, 0.84); border-color: var(--glass-border); }
html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .card { background: var(--glass-strong); border-color: var(--glass-border); box-shadow: var(--shadow); }
html[data-theme="dark"] .verification-side { background: rgba(7, 19, 35, 0.52); border-color: var(--line); }
html[data-theme="dark"] label,
html[data-theme="dark"] legend { color: #d5e1ee; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { color: var(--ink); background: #091727; border-color: #29405b; }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus { background: #0d1b2c; }
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] input:read-only:not(.cal-input) { color: var(--ink-2); background: #101d2e; }
html[data-theme="dark"] .quiet { color: var(--ink-2); background: #122338; border-color: #29405b; }
html[data-theme="dark"] .quiet:hover { color: var(--ink); background: #162a42; border-color: #3d5875; }
html[data-theme="dark"] .domain-preview,
html[data-theme="dark"] .host-facts,
html[data-theme="dark"] .fingerprint,
html[data-theme="dark"] .package-block,
html[data-theme="dark"] .update-target { background: rgba(7, 19, 35, 0.56); border-color: #29405b; }
html[data-theme="dark"] .server-glyph { background: #17283d; }
html[data-theme="dark"] .server-glyph span { background: #66809b; }
html[data-theme="dark"] .update-verify,
html[data-theme="dark"] .access-identity > div { background: #0d1b2c; box-shadow: inset 0 0 0 1px #29405b; }
html[data-theme="dark"] .lock-editor { background: #211923; border-color: rgba(255, 129, 139, 0.34); }
html[data-theme="dark"] .lock-editor p { color: #c7d5e3; }
html[data-theme="dark"] .danger-action.unlock { color: #071f16; background: #8ce3ba; }
html[data-theme="dark"] .progress-panel li::before { background: #122338; border-color: #66809b; }
html[data-theme="dark"] .progress-panel li::after { background: #3d5875; }
html[data-theme="dark"] .success-panel > .result-note { color: #a9ebca; background: rgba(75, 209, 144, 0.14); }
html[data-theme="dark"] .text-button { color: #8bb7ff; }
html[data-theme="dark"] .domain-preview.ready output { color: #8bb7ff; }
html[data-theme="dark"] .privacy-note { color: #8ce3ba; background: var(--success-soft); }
html[data-theme="dark"] .status.neutral,
html[data-theme="dark"] .license-action { color: var(--ink-2); background: #172437; }
html[data-theme="dark"] .license-action:hover { background: #20324a; }
html[data-theme="dark"] .license-action.danger { color: var(--danger); background: var(--danger-soft); }
html[data-theme="dark"] table { color: var(--ink); }
html[data-theme="dark"] th { background: rgba(7, 19, 35, 0.62); color: var(--ink-2); }
html[data-theme="dark"] th,
html[data-theme="dark"] td { border-color: rgba(139, 183, 255, 0.15); }
html[data-theme="dark"] tbody tr:hover { background: rgba(76, 141, 255, 0.07); }
html[data-theme="dark"] .cal-pop { color: var(--ink); background: #122338; border-color: #3d5875; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] .calNav { color: #d5e1ee; background: #17283d; border-color: #3d5875; }
html[data-theme="dark"] .calNav:hover { color: #f4f8fc; background: #1a3352; }
html[data-theme="dark"] .calGrid .cd.on { color: #dce7f2; background: #17283d; border-color: #29405b; }
html[data-theme="dark"] .calGrid .cd.on:hover { color: #fff; background: #2f6bf0; }
html[data-theme="dark"] .calGrid .cd.off { color: #657d96; }
html[data-theme="dark"] .diagnostic-error { color: #ffd4d8; background: #21141d; border-color: rgba(255, 129, 139, 0.36); }
html[data-theme="dark"] .diagnostic-content h3 { color: #ffadb4; }
html[data-theme="dark"] .diagnostic-content > p { color: #efb8bd; }
html[data-theme="dark"] .diagnostic-facts { background: #0d1b2c; box-shadow: inset 0 0 0 1px #3f3442; }
html[data-theme="dark"] .diagnostic-facts dt { color: #d8a2a8; }
html[data-theme="dark"] .diagnostic-facts dd { color: #f4d9dc; }
html[data-theme="dark"] .diagnostic-log { color: #efc8cc; background: #0b1625; border-color: #3f3442; }
html[data-theme="dark"] .diagnostic-actions { color: #e7b2b7; }
html[data-theme="dark"] .diagnostic-retry { color: #ffd4d8; background: #2b1a23; border-color: #6b3b45; }
html[data-theme="dark"] .diagnostic-retry:hover { color: #fff; background: #38202a; border-color: #8c4b58; }
.theme-toggle-preview { position: fixed; z-index: 20; top: 18px; right: 18px; width: auto; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--glass-strong); color: var(--ink); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12); }
html[data-theme="dark"] .theme-toggle-preview { background: #111e31; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28); }
@media (max-width: 640px) {
  .topbar .theme-toggle [data-theme-label], .login-theme-toggle [data-theme-label], .theme-toggle-preview [data-theme-label] { display: none; }
  .topbar .theme-toggle, .login-theme-toggle, .theme-toggle-preview { width: 44px; padding: 0; }
  .login-theme-toggle { top: 14px; right: 14px; }
  .theme-toggle-preview { top: 12px; right: 12px; }
}

/* 舒适黑夜模式：提高运维表单、账本和诊断区的层级辨识度 */
html[data-theme="dark"] {
  --ink:#f7f9fc; --ink-2:#d5deea; --ink-3:#aebcce;
  --glass:#1a2333; --glass-strong:#1d2736;
  --glass-border:#3b4b61; --line:#344258;
  --success:#6ee7b7; --success-soft:#12372f;
  --warning:#f8d486; --warning-soft:#3c311d;
  --danger:#ffadb5; --danger-soft:#44232b;
  --focus:rgba(110,168,255,.72);
  --shadow:0 20px 50px rgba(2,6,23,.36);
  scrollbar-color:#52657d #172033;
}
html[data-theme="dark"] body { background:#111827; }
html[data-theme="dark"] body::before { background:radial-gradient(720px 520px at 12% 5%,rgba(96,165,250,.12),transparent 68%),radial-gradient(720px 560px at 88% 18%,rgba(94,129,191,.08),transparent 70%),linear-gradient(155deg,#101724,#141d2d 56%,#182334); }
html[data-theme="dark"] body::after { opacity:.26; }
html[data-theme="dark"] ::selection { color:#fff; background:#315f9f; }
html[data-theme="dark"] .topbar { background:rgba(17,24,39,.9); border-color:#3b4b61; }
html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .card { background:#1d2736; border-color:#3b4b61; box-shadow:0 12px 30px rgba(2,6,23,.24); }
html[data-theme="dark"] .verification-side { background:#202b3c; border-color:#344258; }
html[data-theme="dark"] label,
html[data-theme="dark"] legend { color:#d5deea; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { color:#f7f9fc; background:#131d2b; border-color:#3b4b61; }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color:#8798ac; opacity:1; }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus { background:#182231; border-color:#6ea8ff; box-shadow:0 0 0 3px rgba(110,168,255,.3); }
html[data-theme="dark"] button:focus-visible,
html[data-theme="dark"] a:focus-visible,
html[data-theme="dark"] input:focus-visible,
html[data-theme="dark"] select:focus-visible,
html[data-theme="dark"] textarea:focus-visible { outline:3px solid rgba(110,168,255,.72); outline-offset:2px; }
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] input:read-only:not(.cal-input) { color:#aebcce; background:#182231; border-color:#2e3b4e; }
html[data-theme="dark"] .quiet,
html[data-theme="dark"] .license-action,
html[data-theme="dark"] .status.neutral { color:#d5deea; background:#202b3c; border-color:#3b4b61; }
html[data-theme="dark"] .quiet:hover,
html[data-theme="dark"] .license-action:hover { color:#fff; background:#2c3b52; border-color:#52657d; }
html[data-theme="dark"] .domain-preview,
html[data-theme="dark"] .host-facts,
html[data-theme="dark"] .fingerprint,
html[data-theme="dark"] .package-block,
html[data-theme="dark"] .update-target,
html[data-theme="dark"] .update-verify,
html[data-theme="dark"] .access-identity > div { background:#202b3c; border-color:#3b4b61; }
html[data-theme="dark"] .access-identity > div { box-shadow:inset 0 0 0 1px #3b4b61; }
html[data-theme="dark"] .server-glyph,
html[data-theme="dark"] .progress-panel li::before { background:#273347; border-color:#52657d; }
html[data-theme="dark"] .progress-panel li::after { background:#52657d; }
html[data-theme="dark"] .text-button,
html[data-theme="dark"] .domain-preview.ready output { color:#9bc2ff; }
html[data-theme="dark"] .privacy-note,
html[data-theme="dark"] .success-panel > .result-note { color:#6ee7b7; background:#12372f; }
html[data-theme="dark"] .lock-editor { background:#34222a; border-color:#70404b; }
html[data-theme="dark"] .lock-editor p { color:#d5deea; }
html[data-theme="dark"] .license-action.danger { color:#ffadb5; background:#44232b; border-color:#70404b; }
html[data-theme="dark"] th { color:#d5deea; background:#182231; }
html[data-theme="dark"] th,
html[data-theme="dark"] td { border-color:#344258; }
html[data-theme="dark"] tbody tr:hover { background:#263348; }
html[data-theme="dark"] .cal-pop { color:#f7f9fc; background:#243044; border-color:#52657d; box-shadow:0 18px 42px rgba(2,6,23,.42); }
html[data-theme="dark"] .calNav,
html[data-theme="dark"] .calGrid .cd.on { color:#e3e9f2; background:#1a2536; border-color:#3b4b61; }
html[data-theme="dark"] .calNav:hover,
html[data-theme="dark"] .calGrid .cd.on:hover { color:#fff; background:#2c3b52; }
html[data-theme="dark"] .calGrid .cd.off { color:#8798ac; }
html[data-theme="dark"] .diagnostic-error { color:#ffd9dd; background:#34222a; border-color:#70404b; }
html[data-theme="dark"] .diagnostic-content h3 { color:#ffbcc3; }
html[data-theme="dark"] .diagnostic-content > p,
html[data-theme="dark"] .diagnostic-actions { color:#e8c4c8; }
html[data-theme="dark"] .diagnostic-facts { background:#202b3c; border-color:#5c3d47; box-shadow:inset 0 0 0 1px #5c3d47; }
html[data-theme="dark"] .diagnostic-facts dt { color:#dcaeb3; }
html[data-theme="dark"] .diagnostic-facts dd { color:#f7dfe2; }
html[data-theme="dark"] .diagnostic-log { color:#efcdd1; background:#131821; border-color:#5c3d47; }
html[data-theme="dark"] .diagnostic-retry { color:#ffd9dd; background:#44232b; border-color:#70404b; }
html[data-theme="dark"] .diagnostic-retry:hover { color:#fff; background:#593039; border-color:#92525f; }
html[data-theme="dark"] .theme-toggle-preview { color:#d5deea; background:#202b3c; border-color:#3b4b61; box-shadow:0 12px 30px rgba(2,6,23,.28); }

.listSelect { display: block; min-width: 0; position: relative; }
.listSelect > select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.listSelectButton { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .88); color: var(--ink); text-align: left; cursor: pointer; }
.listSelectButton::after { content: ''; flex: 0 0 9px; width: 9px; height: 9px; margin: -4px 5px 0 0; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; color: var(--ink-2); transform: rotate(45deg); }
.listSelectButton:hover { border-color: var(--primary); }
.listSelectButton:focus-visible, .listSelectPanel button:focus-visible, .listSelectPanel input:focus-visible { outline: 2px solid var(--primary-d); outline-offset: 2px; }
.listSelectButton:disabled { opacity: .55; cursor: not-allowed; }
.listSelectButton[aria-invalid="true"] { border-color: #c33c45; }
.listSelectError { display: block; margin-top: 4px; color: #c33c45; font-size: 12px; }
.listSelectError[hidden] { display: none; }
.listSelectPanel { position: fixed; z-index: 10000; display: grid; gap: 5px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 18px 48px rgba(40, 59, 100, .2); }
.listSelectPanel[hidden] { display: none; }
.listSelectPanel input { width: 100%; min-height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.listSelectOptions { display: grid; gap: 2px; overflow: auto; overscroll-behavior: contain; max-height: 280px; }
.listSelectOptions button { width: 100%; min-height: 36px; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.listSelectOptions button:hover, .listSelectOptions button[aria-pressed="true"] { background: rgba(79, 140, 255, .13); color: var(--primary-d); }
.audit-filters .listSelect { width: 130px; }
@media (max-width: 640px) { .audit-filters .listSelect { width: 100%; } }
html[data-theme="dark"] .listSelectButton, html[data-theme="dark"] .listSelectPanel, html[data-theme="dark"] .listSelectPanel input { background: #182231; color: #f2f6ff; border-color: rgba(179, 196, 222, .25); }
html[data-theme="dark"] .listSelectOptions button { color: #f2f6ff; }
html[data-theme="dark"] .listSelectOptions button:hover, html[data-theme="dark"] .listSelectOptions button[aria-pressed="true"] { background: #24446b; color: #fff; }
