/* 贾维斯云代理中心 · 本地系统字体，无外部视觉依赖。 */
:root {
  color-scheme: light;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --canvas: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --navy: #101e35;
  --navy-muted: #b5c2d6;
  --success: #166534;
  --success-soft: #f0fdf4;
  --warning: #854d0e;
  --warning-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius: 12px;
  --shadow: 0 2px 8px rgb(15 23 42 / 3%);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); scroll-padding-top: 24px; }
body { margin: 0; color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; }
a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; vertical-align: middle; }
svg { flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(23px, 2.3vw, 29px); line-height: 1.35; letter-spacing: -.025em; font-weight: 700; }
h2 { font-size: 17px; line-height: 1.5; font-weight: 650; }
h3 { font-size: 15px; line-height: 1.5; font-weight: 650; }
small { font-size: 12px; }
hr { margin: 24px 0; border: 0; border-top: 1px solid var(--border); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #60a5fa; outline-offset: 3px; }
::selection { background: #dbeafe; color: #1e3a8a; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; align-self: start; height: 100svh; padding: 30px 18px 20px; color: #fff; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; font-size: 16px; font-weight: 650; line-height: 1.5; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img, .brand > svg { width: 40px; height: 40px; flex: 0 0 40px; }
.brand small, .brand-subtitle { display: block; margin-top: 2px; color: var(--navy-muted); font-size: 11px; font-weight: 400; letter-spacing: .06em; }
.nav-list { display: flex; flex-direction: column; gap: 6px; margin: 34px 0 0; padding: 0; list-style: none; }
.nav-item { background: transparent; text-align: left; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 11px 14px; border: 1px solid transparent; border-radius: 8px; color: var(--navy-muted); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color 140ms, color 140ms; }
.nav-item svg { width: 19px; height: 19px; opacity: .9; }
.nav-item:hover { color: #fff; background: #1b2d47; text-decoration: none; }
.nav-item[aria-current="page"], .nav-item.is-active, .nav-item.active { color: #fff; background: #244986; border-color: #3864a6; }
.sidebar-label { margin: 24px 14px -18px; color: var(--navy-muted); font-size: 11px; letter-spacing: .08em; }
.sidebar-footer { margin-top: auto; padding: 20px 12px 0; color: var(--navy-muted); font-size: 12px; }
.sidebar-footer .badge { margin-bottom: 10px; }
.sidebar-note { padding: 14px; margin-top: 24px; border: 1px solid #2b3e59; border-radius: 8px; color: var(--navy-muted); font-size: 12px; }
.sidebar-note strong { display: block; margin-bottom: 4px; color: #e2e8f0; font-weight: 500; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 78px; padding: 18px 36px; border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar-title { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 13px; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid #bfdbfe; border-radius: 50%; color: #1e40af; background: var(--primary-soft); font-size: 12px; font-weight: 600; }
.page { width: 100%; max-width: 1660px; padding: 32px 36px 48px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading p, .page-description { max-width: 760px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.cluster { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted, .hint { color: var(--muted); }
.mono, code { font-family: var(--mono); font-size: .9em; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.break-word { overflow-wrap: anywhere; }
.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; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 16px; border-radius: 8px; color: #fff; background: var(--primary); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card { min-width: 0; padding: 22px 22px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--primary); background: var(--primary-soft); }
.stat-icon svg { width: 18px; height: 18px; }
.stat-value { display: block; margin-top: 13px; font-size: 30px; font-weight: 650; line-height: 1.2; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-unit { padding-left: 5px; color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.stat-note { margin-top: 10px; color: var(--muted); font-size: 12px; }
.card { min-width: 0; margin-bottom: 22px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card:last-child { margin-bottom: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.card-body { padding: 24px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; background: #fcfdff; }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.table-wrap table { min-width: 660px; }
th { padding: 13px 24px; border-bottom: 1px solid var(--border); color: #475569; background: #f8fafc; font-size: 12px; font-weight: 600; white-space: nowrap; }
td { padding: 17px 24px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
td strong { font-size: 13px; font-weight: 600; }
.cell-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.table-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.table-actions .btn { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.toolbar .search-field { min-width: 220px; max-width: 360px; flex: 1; }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; padding: 3px 9px; border: 1px solid #e2e8f0; border-radius: 5px; color: #475569; background: #f8fafc; font-size: 11px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; vertical-align: middle; }
.badge[data-tone="success"] { border-color: #bbf7d0; color: var(--success); background: var(--success-soft); }
.badge[data-tone="warning"] { border-color: #fde68a; color: var(--warning); background: var(--warning-soft); }
.badge[data-tone="danger"], .badge[data-tone="error"] { border-color: #fecaca; color: var(--danger); background: var(--danger-soft); }
.badge[data-tone="info"], .badge[data-tone="primary"] { border-color: #bfdbfe; color: #1e40af; background: var(--primary-soft); }
.badge[data-tone="neutral"] { border-color: var(--border); color: #475569; background: #f1f5f9; }
.status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 15px; border: 1px solid #cbd5e1; border-radius: 7px; color: var(--text); background: var(--surface); font-size: 13px; font-weight: 550; line-height: 1.5; text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 140ms, border-color 140ms, box-shadow 140ms; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: #94a3b8; background: #f8fafc; text-decoration: none; }
.btn:active { background: #f1f5f9; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn[aria-busy="true"] { cursor: wait; }
.btn-primary { border-color: var(--primary); color: #fff; background: var(--primary); box-shadow: 0 1px 2px rgb(37 99 235 / 12%); }
.btn-primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.btn-primary:active { background: #1e40af; }
.btn-danger { border-color: #fecaca; color: var(--danger); background: #fff; }
.btn-danger:hover { border-color: #fca5a5; background: var(--danger-soft); }
.btn-ghost { border-color: transparent; color: var(--muted); background: transparent; box-shadow: none; }
.btn-ghost:hover { border-color: transparent; color: var(--text); background: #f1f5f9; }
.btn-link { padding-right: 5px; padding-left: 5px; border-color: transparent; color: var(--primary); background: transparent; }
.btn-link:hover { border-color: transparent; background: var(--primary-soft); }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: 6px 11px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label, .field > .field-label { color: var(--text); font-size: 13px; font-weight: 550; }
.required { margin-left: 3px; color: var(--danger); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 7px; color: var(--text); background: var(--surface); font-size: 14px; line-height: 1.5; transition: border-color 140ms, box-shadow 140ms; }
textarea { min-height: 112px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7c8ba0; opacity: 1; }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px #dbeafe; }
input:disabled, select:disabled, textarea:disabled, input[readonly] { color: var(--muted); background: #f8fafc; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input[aria-invalid="true"]:focus, select[aria-invalid="true"]:focus, textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px #fee2e2; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--primary); }
.check-field { display: flex; align-items: flex-start; gap: 9px; min-height: 44px; padding: 10px 0; font-size: 13px; }
.check-field label { cursor: pointer; }
.hint { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.error { padding: 11px 13px; border: 1px solid #fecaca; border-left: 3px solid var(--danger); border-radius: 6px; color: #991b1b; background: var(--danger-soft); font-size: 13px; overflow-wrap: anywhere; }
.field .error { padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 12px; }
.notice { padding: 15px 17px; border: 1px solid #bfdbfe; border-radius: 8px; color: #1e40af; background: var(--primary-soft); font-size: 13px; }
.notice[data-tone="warning"] { color: var(--warning); border-color: #fde68a; background: var(--warning-soft); }
.notice p + p { margin-top: 5px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 240px; padding: 44px 24px; text-align: center; }
.empty-state > svg, .empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; color: #64748b; background: #f8fafc; }
.empty-state h3 { font-size: 14px; }
.empty-state p { max-width: 380px; color: var(--muted); font-size: 13px; }
.empty-state .btn { margin-top: 7px; }
.route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.route-card { padding: 22px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.route-card .field { margin-top: 18px; }
.route-card p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.pool-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pool-summary-item { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.pool-summary-item .stat-value { margin-top: 12px; font-size: 25px; }
.pool-summary-item p { margin-top: 8px; color: var(--muted); font-size: 12px; }
.definition-list { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr; gap: 12px 24px; margin: 0; font-size: 13px; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; overflow-wrap: anywhere; }

.auth-shell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100svh; padding: 40px 20px; background: radial-gradient(ellipse at 50% 0, #eaf1fe 0, transparent 55%), var(--canvas); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; color: var(--text); font-size: 18px; font-weight: 650; }
.auth-brand img { width: 42px; height: 42px; }
.auth-card { width: 100%; max-width: 440px; padding: 32px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: 0 8px 32px rgb(15 23 42 / 5%); }
.auth-card h1 { font-size: 23px; }
.auth-card > p { margin-top: 8px; color: var(--muted); font-size: 13px; }
.auth-card form { margin-top: 27px; }
.auth-card .form-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.auth-card .btn-block { margin-top: 24px; }
.auth-card .notice, .auth-card > .error { margin-top: 20px; }
.auth-footer { margin-top: 24px; color: var(--muted); font-size: 12px; text-align: center; }
.auth-step { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 14px; color: #1e40af; font-size: 12px; font-weight: 550; }
dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100svh - 48px); padding: 0; overflow-y: auto; border: 1px solid var(--border); border-radius: 13px; color: var(--text); background: #fff; box-shadow: 0 24px 80px rgb(15 23 42 / 20%); }
dialog::backdrop { background: rgb(15 23 42 / 45%); backdrop-filter: blur(2px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 24px; border-bottom: 1px solid var(--border); }
.dialog-header p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.dialog-body { padding: 24px; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 18px 24px; border-top: 1px solid var(--border); background: #f8fafc; }
.toast { position: fixed; z-index: 100; right: 28px; bottom: 28px; display: flex; align-items: flex-start; gap: 10px; width: min(420px, calc(100% - 40px)); padding: 15px 18px; border: 1px solid #bbf7d0; border-left: 3px solid var(--success); border-radius: 9px; color: var(--success); background: #fff; box-shadow: 0 8px 32px rgb(15 23 42 / 12%); font-size: 13px; overflow-wrap: anywhere; }
.toast[data-tone="danger"], .toast[data-tone="error"] { color: var(--danger); border-color: #fecaca; border-left-color: var(--danger); }
.toast[data-tone="info"] { color: #1e40af; border-color: #bfdbfe; border-left-color: var(--primary); }
.toast .btn { flex-shrink: 0; min-width: 32px; min-height: 32px; padding: 4px; margin: -5px -7px -5px auto; }
.spinner { display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: middle; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 1600px) {
  .page { padding-right: 48px; padding-left: 48px; }
  .topbar { padding-right: 48px; padding-left: 48px; }
}
@media (max-width: 1199px) {
  .app-shell { grid-template-columns: 218px minmax(0, 1fr); }
  .sidebar { padding-right: 14px; padding-left: 14px; }
  .brand { gap: 9px; font-size: 14px; }
  .brand img, .brand > svg { width: 36px; height: 36px; flex-basis: 36px; }
  .page { padding: 28px 24px 40px; }
  .topbar { padding-right: 24px; padding-left: 24px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .pool-summary { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .pool-summary-item { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; }
  .pool-summary-item .stat-value { grid-column: 2; grid-row: 1 / 3; align-self: center; margin: 0; }
}
@media (max-width: 899px) {
  html { scroll-padding-top: 140px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; z-index: 20; height: auto; padding: 16px 24px 0; }
  .brand { font-size: 15px; }
  .brand small, .brand-subtitle { display: none; }
  .brand img, .brand > svg { width: 32px; height: 32px; flex-basis: 32px; }
  .nav-list { flex-direction: row; gap: 4px; margin-top: 16px; padding-bottom: 12px; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
  .nav-list > li { flex-shrink: 0; }
  .nav-item { gap: 8px; min-height: 44px; padding: 10px 12px; font-size: 13px; }
  .nav-item svg { width: 17px; height: 17px; }
  .sidebar-footer, .sidebar-note { display: none; }
  .topbar { min-height: 64px; padding-top: 12px; padding-bottom: 12px; }
  .page-heading { gap: 16px; }
  .route-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 599px) {
  body { font-size: 14px; }
  .sidebar { padding: 14px 16px 0; }
  .nav-list { margin-top: 12px; margin-right: -16px; padding-right: 16px; padding-bottom: 10px; }
  .topbar { gap: 10px; padding: 12px 16px; }
  .topbar-title { font-size: 12px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .btn { min-height: 36px; padding: 6px 9px; font-size: 12px; }
  .user-chip { font-size: 12px; }
  .avatar { display: none; }
  .page { padding: 24px 16px 32px; }
  .page-heading { flex-direction: column; align-items: stretch; margin-bottom: 22px; }
  .page-heading p { font-size: 13px; }
  .page-heading .actions { justify-content: flex-start; }
  .stats-grid { gap: 12px; margin-bottom: 22px; }
  .stat-card { padding: 17px 15px; }
  .stat-label { gap: 6px; font-size: 12px; }
  .stat-icon { display: none; }
  .stat-value { margin-top: 11px; font-size: 27px; }
  .stat-note { font-size: 11px; }
  .card { margin-bottom: 18px; }
  .card-header { align-items: flex-start; flex-wrap: wrap; gap: 12px; padding: 18px; }
  .card-body, .dialog-body { padding: 18px; }
  .card-footer { padding: 14px 18px; }
  .toolbar { gap: 10px; padding: 14px 18px; }
  .toolbar .search-field { min-width: 0; max-width: none; flex-basis: 100%; }
  .toolbar .actions { justify-content: flex-start; }
  th { padding: 12px 18px; }
  td { padding: 15px 18px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px; }
  .form-actions { gap: 8px; }
  .form-actions .btn { flex: 1; }
  .route-card { padding: 18px; }
  .pool-summary-item { padding: 17px; }
  .empty-state { min-height: 220px; padding: 34px 18px; }
  .auth-shell { padding: 32px 16px; }
  .auth-brand { gap: 10px; margin-bottom: 24px; font-size: 17px; }
  .auth-card { padding: 26px 22px; }
  .auth-card h1 { font-size: 22px; }
  .dialog-header { padding: 20px 18px; }
  .dialog-footer { flex-wrap: wrap; padding: 16px 18px; }
  .dialog-footer .btn { flex: 1; }
  .toast { right: 16px; bottom: 16px; width: calc(100% - 32px); }
  .definition-list { grid-template-columns: minmax(80px, 1fr) 2fr; gap: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .spinner { animation: none; border-style: dotted; border-right-color: currentColor; }
}
