:root {
  --sidebar: #ffffff;
  --sidebar-2: #f8fafc;
  --sidebar-text: #6b7280;
  --sidebar-text-strong: #111827;
  --sidebar-border: #e5e7eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --topbar: #ffffff;
  --soft: #f3f4f6;
  --soft-2: #f8fafc;
  --field: #ffffff;
  --primary: #1d4ed8;
  --brand: #1e40af;
  --brand-2: #1d4ed8;
  --brand-gradient: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  --brand-shadow: 0 12px 28px rgba(29, 78, 216, .18);
  --primary-soft: rgba(29, 78, 216, .12);
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

:root[data-theme="dark"] {
  --sidebar: #0b1720;
  --sidebar-2: #152b35;
  --sidebar-text: #cbd5e1;
  --sidebar-text-strong: #ffffff;
  --sidebar-border: #263449;
  --bg: #0f172a;
  --card: #172033;
  --text: #e5edf7;
  --muted: #94a3b8;
  --line: #263449;
  --topbar: #121c2d;
  --soft: #1f2a3d;
  --soft-2: #141f31;
  --field: #101a2b;
  --shadow: 0 10px 26px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Noto Sans SC", "Source Han Sans SC", "Source Han Sans CN", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: 0;
}
button, input, select, textarea {
  font: inherit;
}
code {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hidden { display: none !important; }

.login-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  overflow: hidden;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  background:
    linear-gradient(138deg, rgba(255, 255, 255, .92) 0%, rgba(235, 246, 255, .88) 36%, rgba(201, 226, 252, .92) 100%),
    #dceeff;
}
.login-view::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(42deg, transparent 0 40%, rgba(62, 139, 220, .30) 40.3%, rgba(62, 139, 220, .08) 48%, transparent 58%),
    linear-gradient(158deg, transparent 0 52%, rgba(255, 255, 255, .72) 52.3%, rgba(255, 255, 255, .26) 62%, transparent 72%);
  opacity: .88;
}
.login-view::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -18%;
  height: 44%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .56), rgba(127, 183, 241, .20));
  transform: rotate(-3deg);
  transform-origin: center;
}
.login-page-brand {
  position: absolute;
  top: 58px;
  left: 68px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #08111f;
  font-family: inherit;
  font-size: 22px;
}
.login-page-brand strong {
  display: block;
  font-family: inherit;
  font-style: normal;
  letter-spacing: 0;
  font-size: 1em;
  font-weight: 800;
  line-height: 1.2;
}
.login-brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-gradient);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: var(--brand-shadow);
}
.login-shell {
  width: min(520px, 100%);
}
.login-hero-panel {
  display: none;
}
.login-brand-invert h1,
.login-brand-invert p {
  color: var(--text);
}
.login-hero-copy {
  display: none;
}
.login-kicker {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid #d6e4ff;
  border-radius: 999px;
  color: var(--primary);
  background: #f5f8ff;
  font-size: 12px;
  font-weight: 700;
}
.login-hero-copy h2 {
  display: none;
}
.login-hero-copy p {
  display: none;
}
.login-metrics {
  display: none;
}
.login-metrics div {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  background: #fbfcff;
}
.login-metrics strong {
  display: block;
  color: #172033;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}
.login-metrics span {
  display: block;
  margin-top: 6px;
  color: #748094;
  font-size: 12px;
}
.login-card {
  width: 100%;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(20, 80, 145, .20);
  padding: 44px 46px 34px;
  font-family: inherit;
  font-size: 14px;
}
.login-card-unified {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
}
.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}
.login-brand-main {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #edf1f6;
}
.compact-brand {
  margin: 18px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
}
.compact-brand strong,
.compact-brand span {
  display: block;
}
.compact-brand span {
  color: var(--muted);
  font-size: 12px;
}
.login-card-head h2 {
  margin: 0 0 28px;
  color: #050b16;
  font-family: inherit;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}
.login-card-head p {
  display: none;
}
.login-reset-card .login-card-head p {
  display: block;
  margin: -20px 0 28px;
  color: #6b7484;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}
.login-form-panel {
  padding-top: 0;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--brand-gradient);
  font-weight: 800;
  box-shadow: var(--brand-shadow);
}
.brand-mark.small {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.login-brand h1 {
  margin: 0;
  color: #172033;
  font-size: 21px;
  font-weight: 800;
}
.login-brand p {
  margin: 4px 0 0;
  color: #6b7484;
}
.login-brand-invert p {
  color: #cbd5e1;
}
.login-card .login-kicker {
  color: var(--primary);
  border-color: #bfdbfe;
  background: #eff6ff;
}
.login-card label {
  margin: 0;
}
.login-card input,
.filters input,
.filters select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  background: var(--field);
  color: var(--text);
}
.login-card input {
  height: 52px;
  border-color: transparent;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
}
.login-card input:focus,
.filters input:focus,
.filters select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .10);
}
.login-card .login-field input:focus {
  border-color: transparent;
  box-shadow: none;
}
.login-field {
  position: relative;
  display: flex !important;
  align-items: center;
  height: 52px;
  margin-bottom: 24px !important;
  border: 1px solid #d9dfe8;
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  overflow: hidden;
}
.login-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .10);
}
.login-field-prefix {
  width: 62px;
  height: 100%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-right: 1px solid #e5eaf1;
  color: #657083;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  background: rgba(247, 250, 253, .72);
}
.login-field-prefix:has(.login-field-icon) {
  width: 52px;
  flex: 0 0 52px;
  color: #4b5563;
  font-size: 0;
  font-weight: 400;
  background: rgba(243, 246, 250, .9);
}
.login-field-icon {
  display: block;
  width: 22px;
  height: 22px;
}
.login-field-icon-solid {
  overflow: visible;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .18));
}
.login-field:focus-within .login-field-prefix:has(.login-field-icon) {
  color: var(--primary);
  background: var(--primary-soft);
}
.login-field:focus-within .login-field-icon-solid {
  filter: drop-shadow(0 1px 2px rgba(29, 78, 216, .28));
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.login-field input {
  flex: 1;
  min-width: 0;
  padding: 0 18px;
  color: #0f172a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
}
.login-password-field input {
  padding-right: 8px;
}
/* 隐藏 Edge/IE 自带密码眼睛，避免与自定义切换按钮重叠（有内容时才出现） */
.login-password-field input::-ms-reveal,
.login-password-field input::-ms-clear,
.password-input-wrap input::-ms-reveal,
.password-input-wrap input::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}
.login-password-toggle {
  flex: 0 0 48px;
  width: 48px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid #e5eaf1;
  border-radius: 0;
  background: rgba(247, 250, 253, .72);
  color: #657083;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  position: relative;
  z-index: 3;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.login-password-toggle .iconfont,
.login-password-toggle .login-eye-icon {
  pointer-events: none;
}
.login-password-toggle .login-eye-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}
.login-password-toggle:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.login-password-toggle.is-masked {
  opacity: 1;
  color: #4b5563;
}
.login-field:focus-within .login-password-toggle {
  border-left-color: rgba(29, 78, 216, .18);
}
.login-field input::placeholder {
  color: #a1a8b3;
}
.login-textarea-field {
  display: block !important;
  margin: 0 0 24px !important;
}
.login-textarea-field .login-textarea-label,
.login-textarea-field > span {
  display: block;
  margin: 0 0 10px;
  color: #1f2937;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
}
.login-textarea-field textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid #d9dfe8;
  border-radius: 8px;
  padding: 14px 18px;
  outline: none;
  color: #0f172a;
  background: rgba(255, 255, 255, .88);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}
.login-textarea-field textarea::placeholder {
  color: #a1a8b3;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
}
.login-textarea-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .10);
}
.login-reset-options {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 16px 0 0;
  text-align: center;
}
.login-reset-options a {
  color: var(--brand);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
}
.login-reset-options a:hover {
  color: var(--primary);
}
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 28px;
  color: #1b3868;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
}
.remember-row {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  color: #1f2937;
}
.remember-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}
.login-options a {
  color: var(--brand);
  text-decoration: none;
}
.login-options a:hover {
  color: var(--primary);
}
.login-footnote {
  margin-top: 12px;
  color: #7b8494;
  font-size: 12px;
  text-align: center;
}
.login-copyright {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(15, 23, 42, .08);
  text-align: center;
}
.login-copyright,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
}
.beian-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 6px 12px;
  color: #333;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
}
.site-footer .beian-row {
  color: var(--muted);
}
.beian-icons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.beian-icons img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.login-copyright a,
.site-footer a,
.beian-row a {
  color: inherit;
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}
.login-copyright a:hover,
.site-footer a:hover,
.beian-row a:hover {
  color: var(--primary);
  text-decoration: underline;
}
.primary-btn,
.ghost-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.primary-btn {
  width: 100%;
  height: 40px;
  margin-top: 18px;
  color: #fff;
  background: var(--brand-gradient);
  font-weight: 700;
}
.primary-btn:hover {
  background: linear-gradient(135deg, #083d7c 0%, var(--brand) 100%);
}
.login-card .primary-btn {
  height: 48px;
  margin-top: 0;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand-gradient);
  box-shadow: var(--brand-shadow);
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
}
.login-card .primary-btn:hover {
  background: linear-gradient(135deg, #083d7c 0%, var(--brand) 100%);
}
.login-card .primary-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}
.login-secondary-btn {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--brand);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}
.login-secondary-btn:hover {
  background: #e2e8f0;
}
.login-card .form-error {
  margin-top: 10px;
  text-align: center;
}
.captcha-box {
  margin: 0 0 24px;
  padding: 0;
  width: 100%;
}
.captcha-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
}
.captcha-input-wrap {
  flex: 1 1 0;
  min-width: 0;
  margin: 0 !important;
  height: 52px;
}
.captcha-image-btn {
  position: relative;
  flex: 0 0 120px;
  width: 120px;
  height: 52px;
  padding: 0;
  border: 1px solid #d9dfe8;
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  cursor: pointer;
  overflow: hidden;
}
.captcha-image-btn:hover {
  border-color: #93c5fd;
}
.captcha-image {
  width: 100%;
  height: 100%;
  display: block;
  margin: 0;
  padding: 6px;
  box-sizing: border-box;
  object-fit: contain;
  user-select: none;
  transition: filter .18s ease, opacity .18s ease;
}
.captcha-image-btn.is-masked .captcha-image {
  filter: blur(5px) brightness(1.05);
  opacity: .72;
}
.captcha-image-btn.is-masked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, .35);
  pointer-events: none;
}
/* 客户端 WebView：强制不显示验证码蒙版 */
html.captcha-no-mask .captcha-image-btn.is-masked .captcha-image {
  filter: none;
  opacity: 1;
}
html.captcha-no-mask .captcha-image-btn.is-masked::after {
  display: none;
}
.captcha-box.is-locked .captcha-image-btn,
.captcha-box.is-locked #captchaCode {
  opacity: .55;
  pointer-events: none;
}
.small-btn {
  width: auto;
  min-width: 88px;
  margin-top: 0;
}
.ghost-btn {
  height: 34px;
  padding: 0 12px;
  color: var(--text);
  background: var(--soft);
}
.login-card .login-secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  padding: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--brand);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}
.ghost-link {
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}
.ghost-link:hover,
.ghost-btn:hover,
.icon-btn:hover {
  background: var(--line);
}
.icon-btn {
  width: 36px;
  height: 36px;
  background: var(--soft);
}
.form-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
}
.form-error.success {
  color: var(--success);
}

.app-shell {
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  background: var(--bg);
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  padding: 16px 12px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 1px 0 0 rgba(15, 23, 42, .02);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  margin-bottom: 14px;
  padding: 0 10px;
  color: var(--sidebar-text-strong);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  cursor: default;
  user-select: none;
  border-radius: 10px;
}
.sidebar-brand:focus-visible {
  outline: 2px solid rgba(29, 78, 216, .55);
  outline-offset: 2px;
}
.sidebar-brand span {
  white-space: nowrap;
  transition: opacity .18s ease;
  font-size: 14px;
  font-weight: 700;
}
.sidebar nav {
  display: grid;
  gap: 16px;
}
.nav-section {
  display: grid;
  gap: 3px;
}
.nav-section-title {
  padding: 0 12px 6px;
  color: #94a3b8;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--sidebar-text);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.nav-item:hover {
  color: var(--sidebar-text-strong);
  background: var(--sidebar-2);
}
.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
  font-weight: 600;
}
.nav-item span {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  opacity: .85;
  transition: transform .18s ease, opacity .18s ease;
}
.nav-item:hover span,
.nav-item.active span {
  opacity: 1;
  transform: scale(1.06);
}
.sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}
.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}
.sidebar-collapsed .sidebar-brand > span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}
.sidebar-collapsed .nav-section-title {
  display: none;
}
.sidebar-collapsed .sidebar nav {
  gap: 4px;
}
.sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 0;
  font-size: 0;
}
.sidebar-collapsed .nav-item span {
  font-size: 17px;
}

.workspace {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 420px at 100% -10%, rgba(29, 78, 216, .06), transparent 55%),
    var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
:root[data-theme="dark"] .topbar {
  background: rgba(18, 28, 45, .88);
}
.topbar-left {
  display: flex;
  align-items: center;
  min-width: 48px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-badge {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.admin-chip {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 6px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 999px;
  background: rgba(248, 250, 252, .92);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}
.admin-chip.no-avatar {
  padding-left: 10px;
}
.admin-avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #b45309;
  background: #ffedd5;
  font-size: 12px;
  font-weight: 800;
}
.admin-avatar.hidden {
  display: none;
}
.topbar-icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
  font-size: 16px;
}
.topbar-icon-btn:hover {
  background: var(--soft);
}
.sidebar-toggle {
  color: var(--muted);
  background: transparent;
}
.sidebar-toggle:hover {
  color: var(--text);
  background: var(--soft);
}
.topbar-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.content {
  flex: 0 0 auto;
  min-height: calc(100vh - 56px);
  width: 100%;
  max-width: none;
  padding: 16px 20px 36px;
  box-sizing: border-box;
}
.page-agent {
  height: calc(100vh - 56px - 48px);
  min-height: 560px;
}
.page-agent .agent-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f7f7f8;
  border: 1px solid #e7e7ea;
  border-radius: 16px;
  overflow: hidden;
}
.agent-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid #ececef;
  background: #fff;
}
.agent-topbar-left,
.agent-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-topbar-title {
  display: block;
  line-height: 1;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}
.agent-ghost-btn,
.agent-icon-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  border-radius: 10px;
  height: 34px;
  padding: 0 12px;
  cursor: pointer;
}
.agent-icon-btn {
  width: 34px;
  padding: 0;
}
.agent-messages {
  flex: 1;
  overflow: auto;
  padding: 28px 18px 12px;
}
.agent-empty {
  max-width: 520px;
  margin: 48px auto 0;
  text-align: center;
}
.agent-empty-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  font-size: 20px;
}
.agent-empty h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}
.agent-empty p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}
.agent-empty-error {
  margin-top: 12px !important;
  color: #b91c1c !important;
}
.agent-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.agent-chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}
.agent-msg {
  display: flex;
  margin: 0 auto 14px;
  max-width: 760px;
}
.agent-msg.user {
  justify-content: flex-end;
}
.agent-bubble {
  max-width: min(100%, 640px);
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.65;
  color: #111827;
  background: #fff;
  border: 1px solid #ececef;
  white-space: normal;
  word-break: break-word;
}
.agent-bubble .agent-h {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: .01em;
}
.agent-bubble .agent-h1 { font-size: 18px; }
.agent-bubble .agent-h2 { font-size: 16px; }
.agent-bubble .agent-h3 { font-size: 14px; margin-top: 14px; }
.agent-bubble .agent-p {
  margin: 0 0 8px;
}
.agent-bubble .agent-p:last-child { margin-bottom: 0; }
.agent-bubble .agent-gap { height: 6px; }
.agent-bubble .agent-hr {
  border: 0;
  border-top: 1px solid #eef0f3;
  margin: 12px 0;
}
.agent-bubble .agent-ul {
  margin: 0 0 8px;
  padding-left: 1.2em;
}
.agent-bubble .agent-ul li { margin: 2px 0; }
.agent-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  margin: 0 2px 0 0;
  border-radius: 50%;
  flex: 0 0 auto;
}
.agent-h .agent-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
}
.agent-table-wrap {
  overflow: auto;
  margin: 8px 0 12px;
  border: 1px solid #eef0f3;
  border-radius: 10px;
}
.agent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.agent-table th,
.agent-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef0f3;
  text-align: left;
  white-space: nowrap;
}
.agent-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}
.agent-table tr:last-child td { border-bottom: 0; }
.agent-table .agent-icon {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
}
.agent-msg.user .agent-bubble {
  background: #ececf1;
  border-color: transparent;
}
.agent-typing {
  color: #6b7280;
}
.agent-served-model {
  margin-top: 8px;
  font-size: 11px;
  color: #9ca3af;
}
.agent-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eef0f3;
  font-size: 12px;
  color: #6b7280;
}
.agent-export-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  height: 30px;
  padding: 0 10px;
  cursor: pointer;
  color: #111827;
}
.agent-composer-wrap {
  padding: 8px 16px 16px;
  background: linear-gradient(180deg, rgba(247,247,248,0), #f7f7f8 28%);
}
.agent-key-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  max-width: 360px;
}
.agent-key-panel.hidden {
  display: none;
}
.agent-key-panel input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  font: inherit;
  font-size: 12px;
  color: #111827;
  outline: none;
}
.agent-key-panel input:focus {
  border-color: #cbd5e1;
  background: #fff;
}
.agent-key-save {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.agent-composer {
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 22px;
  padding: 10px 12px 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
  transition: opacity .15s ease, filter .15s ease;
}
.agent-composer.is-busy,
.agent-composer-wrap.is-busy .agent-composer {
  opacity: .55;
  filter: grayscale(.35);
  pointer-events: none;
  cursor: not-allowed;
  background: #f3f4f6;
  box-shadow: none;
}
.agent-composer.is-busy textarea,
.agent-composer.is-busy button,
.agent-composer.is-busy input {
  cursor: not-allowed;
}
.agent-topbar-right .agent-ghost-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}
.agent-composer textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #111827;
  background: transparent;
}
.agent-composer textarea::placeholder {
  color: transparent;
}
.agent-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 8px;
}
.agent-composer-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.agent-model-pill,
.agent-perm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.agent-perm-pill.is-auto {
  background: #eef6ff;
  color: var(--brand);
}
.agent-perm-pill.is-ask {
  background: #fff7ed;
  color: #9a3412;
}
.agent-perm-icon {
  font-size: 12px;
  line-height: 1;
}
.agent-model-pill:hover,
.agent-perm-pill:hover {
  background: #e5e7eb;
}
.agent-perm-pill.is-auto:hover {
  background: #e0effe;
}
.agent-perm-pill.is-ask:hover {
  background: #ffedd5;
}
.agent-model-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
}
.agent-model-pill.is-ready .agent-model-dot {
  background: #10b981;
}
.agent-send-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.agent-send-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
:root[data-theme="dark"] .page-agent .agent-shell,
:root[data-theme="dark"] .agent-composer-wrap {
  background: #12141a;
}
:root[data-theme="dark"] .agent-topbar,
:root[data-theme="dark"] .agent-composer,
:root[data-theme="dark"] .agent-bubble,
:root[data-theme="dark"] .agent-chip,
:root[data-theme="dark"] .agent-ghost-btn,
:root[data-theme="dark"] .agent-icon-btn,
:root[data-theme="dark"] .agent-export-btn {
  background: #1a1d24;
  border-color: #2a2f3a;
  color: #e5e7eb;
}
:root[data-theme="dark"] .agent-msg.user .agent-bubble {
  background: #2a2f3a;
}
:root[data-theme="dark"] .agent-model-pill {
  background: #2a2f3a;
  color: #e5e7eb;
}
:root[data-theme="dark"] .agent-key-panel input {
  background: #12141a;
  border-color: #2a2f3a;
  color: #e5e7eb;
}
.site-footer {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 18px 28px 28px;
  border-top: 1px solid transparent;
  background: transparent;
}
.site-footer .beian-row {
  justify-content: center;
  opacity: .72;
}
.site-footer .beian-row:hover {
  opacity: 1;
}
:root[data-theme="dark"] .site-footer {
  border-top-color: transparent;
  background: transparent;
}
:root[data-theme="dark"] .login-copyright {
  border-top-color: rgba(148, 163, 184, .18);
}
.page {
  display: none;
  width: 100%;
}
.page.active {
  display: block;
  width: 100%;
  animation: pageEnter .28s ease both;
}
@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .page.active {
    animation: none;
  }
  .nav-item,
  .nav-item span,
  .metric-card,
  .panel,
  .config-card,
  .clickable-card,
  .clickable-row td,
  .primary-btn {
    transition: none !important;
  }
}
.page-title {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .96) 0%, rgba(248, 250, 252, .9) 100%);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .03);
  box-sizing: border-box;
}
.page-title-with-actions {
  justify-content: space-between;
}
.page-title-with-actions > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.page-actions .primary-btn,
.page-actions .ghost-btn,
.page-actions .page-action-btn,
.form-actions .primary-btn,
.subpage-head .primary-btn {
  width: auto;
  margin-top: 0;
}
.page-actions .primary-btn,
.page-actions .ghost-btn,
.page-actions .page-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 96px;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.page-actions .ghost-btn.page-action-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--card);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}
.page-actions .ghost-btn.page-action-btn:hover {
  color: var(--primary);
  border-color: rgba(29, 78, 216, .28);
  background: #f8fbff;
}
.page-actions .page-action-btn .nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.page-actions .page-action-btn .nav-count-badge.hidden {
  display: none;
}
.table-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.page-actions .primary-btn.page-action-btn {
  border: 1px solid transparent;
}
.page-actions .page-action-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
:root[data-theme="dark"] .page-actions .ghost-btn.page-action-btn:hover {
  background: var(--soft);
}
.title-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow: 0 8px 18px rgba(29, 78, 216, .18);
  font-size: 20px;
  transition: transform .2s ease;
}
.page-title:hover .title-icon {
  transform: scale(1.04) rotate(-2deg);
}
.page-title h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}
.page-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  align-items: stretch;
}
@media (min-width: 1440px) {
  .metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}
.metric-card,
.panel,
.config-card {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.metric-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  min-height: 120px;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
  margin: 0;
  font: inherit;
  text-align: left;
}
.metric-card::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 78, 216, .12), transparent 68%);
  pointer-events: none;
}
.metric-card:hover,
.panel:hover,
.config-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, .08);
  border-color: rgba(29, 78, 216, .22);
}
.clickable-card {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(226, 232, 240, .95);
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.clickable-card:hover {
  border-color: rgba(29, 78, 216, .45);
  box-shadow: 0 14px 30px rgba(29, 78, 216, .12);
  transform: translateY(-2px);
}
.metric-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.metric-value {
  margin-top: 8px;
  font-size: clamp(22px, 1.8vw, 30px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: #0f172a;
  background: linear-gradient(180deg, #0f172a 0%, #1e3a8a 140%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
:root[data-theme="dark"] .metric-value {
  background: none;
  color: var(--text);
  -webkit-background-clip: unset;
  background-clip: unset;
}
.metric-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.grid-2 {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.grid-2 > .panel {
  min-height: 320px;
  height: 100%;
  box-sizing: border-box;
}
.panel {
  width: 100%;
  padding: 16px;
  box-sizing: border-box;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(226, 232, 240, .8);
}
.panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.panel-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.docs-stack {
  display: grid;
  gap: 16px;
}
.docs-code {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border-radius: 8px;
  background: #0f172a;
  color: #e5e7eb;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}
:root[data-theme="dark"] .docs-code {
  background: #020617;
  border: 1px solid var(--line);
}
.filters {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(240px, 1fr) 180px 140px 90px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 12px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .03);
  box-sizing: border-box;
}
.filter-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(29, 78, 216, .28);
  border-radius: 999px;
  background: var(--primary-soft);
  font-size: 13px;
}
.filter-chip-text {
  font-weight: 700;
  color: var(--primary);
}
/* 仅纵向堆叠时加间距；grid 并排时不要给第二块加 margin-top */
.page > .panel + .panel {
  margin-top: 16px;
}
.page .grid-2 > .panel + .panel,
.page .config-grid > .panel + .panel {
  margin-top: 0;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4b5563;
}
.switch-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 2px;
}
.filter-switch {
  width: 120px;
  justify-content: flex-start;
  gap: 10px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 700;
}
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 42px;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.switch i {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background .16s ease;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .22);
  transition: transform .16s ease;
}
.switch input:checked + i {
  background: var(--brand-gradient);
}
.switch input:checked + i::after {
  transform: translateX(18px);
}
.switch input:focus-visible + i {
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.stack {
  display: grid;
  gap: 16px;
}
.form-grid {
  display: grid;
  gap: 12px;
}
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--field);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}
.form-grid input,
.form-grid select {
  height: 38px;
  padding: 0 10px;
}
.form-grid textarea {
  min-height: 108px;
  padding: 10px;
  resize: vertical;
  line-height: 1.5;
}
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .10);
}
.table-wrap {
  width: 100%;
  min-height: 420px;
  overflow: auto;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
  box-sizing: border-box;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}
th, td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
  transition: background .15s ease;
}
th {
  color: #64748b;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
td {
  color: var(--text);
}
tbody tr:last-child td {
  border-bottom: 0;
}
.clickable-row {
  cursor: pointer;
}
.clickable-row:hover td {
  background: rgba(29, 78, 216, .04);
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
}
.tag.success { color: #166534; background: #dcfce7; }
.tag.warning { color: #92400e; background: #fef3c7; }
.tag.danger { color: #991b1b; background: #fee2e2; }
.tag.info { color: var(--brand); background: #dbeafe; }
.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
  transition: color .15s ease, opacity .15s ease;
}
.link-btn:hover {
  color: var(--brand);
  opacity: .9;
}
.detail-table-wrap table {
  min-width: 980px;
}
.danger-link {
  color: var(--danger);
}
.actions-cell {
  display: flex;
  gap: 10px;
}
.remark-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mono-id {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--soft-2);
  border-radius: 4px;
  padding: 2px 6px;
}
.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}
.cell-stack strong {
  font-size: 13px;
}
.cell-stack small {
  color: var(--muted);
  font-size: 12px;
}
.lead-detail-grid .detail-item span {
  display: block;
  margin-bottom: 4px;
}
.detail-item-wide {
  grid-column: 1 / -1;
}
.compact-json {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
}
.summary-table {
  min-width: 1280px;
}
.summary-table td {
  vertical-align: top;
  line-height: 1.55;
}
.progress-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.muted-text {
  color: var(--muted);
  font-size: 12px;
}
.bar-chart {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  min-height: 260px;
  height: calc(100% - 48px);
  padding-top: 16px;
  box-sizing: border-box;
}
.bar {
  display: grid;
  align-items: end;
  gap: 8px;
  min-width: 0;
  text-align: center;
}
.bar-fill {
  min-height: 8px;
  border-radius: 6px 6px 0 0;
  background: var(--brand-gradient);
}
.bar-label {
  color: var(--muted);
  font-size: 12px;
}
.rank-list,
.log-list,
.role-list {
  display: grid;
  gap: 10px;
}
.rank-item,
.log-item,
.follow-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
  font-size: 13px;
}
.follow-item {
  align-items: flex-start;
}
.follow-item strong,
.follow-item span,
.follow-item time {
  display: block;
}
.follow-item span {
  margin-top: 3px;
  color: var(--primary);
  font-weight: 700;
}
.follow-item p {
  margin: 5px 0 0;
  color: var(--muted);
}
.follow-item time {
  color: var(--muted);
  white-space: nowrap;
}
.role-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
}
.role-card div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.role-card code {
  color: var(--muted);
  font-size: 12px;
}
.role-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.role-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.user-subview {
  display: grid;
  gap: 16px;
}
.user-subview.is-enter {
  animation: user-subview-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.user-subview.is-enter .subpage-head {
  animation: user-subhead-pulse 0.45s ease;
}
@keyframes user-subview-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes user-subhead-pulse {
  from {
    border-color: #93c5fd;
    background: #eff6ff;
  }
  to {
    border-color: var(--line);
    background: var(--card);
  }
}
@media (prefers-reduced-motion: reduce) {
  .user-subview.is-enter,
  .user-subview.is-enter .subpage-head {
    animation: none;
  }
}
.user-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.user-stat-card {
  min-height: 110px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.user-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.user-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
}
.user-stat-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.user-list-panel {
  min-width: 0;
}
.subpage-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.subpage-head > div {
  min-width: 0;
  flex: 1;
}
.subpage-head h3 {
  margin: 0;
  font-size: 18px;
}
.subpage-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.user-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}
.user-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.user-form-grid input[type="hidden"] {
  display: none;
}
.user-form-grid #newStoreScopeWrap {
  grid-column: 1 / -1;
}
.form-switch-row {
  align-self: end;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--soft-2);
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.user-guide-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.guide-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.guide-list div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
}
.guide-list strong,
.guide-list span {
  display: block;
}
.guide-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.role-page-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.role-page-list .role-card {
  align-content: start;
  min-height: 150px;
}
.config-grid {
  display: grid;
  gap: 16px;
}
.config-card {
  padding: 18px;
  min-width: 0;
}
.integration-panel {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.integration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.integration-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.integration-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.integration-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.integration-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--soft-2);
}
.integration-status div {
  min-width: 0;
  padding: 13px 18px;
  border-right: 1px solid var(--line);
}
.integration-status div:last-child {
  border-right: 0;
}
.integration-status span,
.callback-preview span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.integration-status strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.integration-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 18px;
}
.integration-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}
.integration-form .wide-field {
  grid-column: 1 / -1;
}
.config-toggle {
  align-self: end;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--soft-2);
}
.integration-help {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
}
.integration-help h4 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}
.integration-help dl {
  display: grid;
  gap: 10px;
  margin: 0;
}
.integration-help dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}
.integration-help dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.integration-help dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}
.password-field .password-input-wrap {
  position: relative;
  display: block;
}
.password-input-wrap input {
  width: 100%;
  padding-right: 42px;
}
.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.password-toggle-btn .iconfont,
.password-toggle-btn .login-eye-icon {
  pointer-events: none;
}
.password-toggle-btn .login-eye-icon {
  display: block;
  width: 18px;
  height: 18px;
}
.password-toggle-btn:hover {
  background: var(--soft);
  color: var(--text);
}
.password-toggle-btn.is-masked {
  opacity: .72;
}

.callback-preview {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.callback-preview code {
  display: block;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #1e3a8a;
  background: var(--soft);
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 400;
}
.config-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.config-row span:first-child {
  color: var(--muted);
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.pager-total {
  margin-right: 4px;
  color: var(--muted);
  font-size: 13px;
}
.pager-btn {
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
}
.pager-btn.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand-gradient);
}
.pager-btn:not(:disabled):hover {
  color: var(--brand);
  border-color: rgba(29, 78, 216, .35);
}
.pager-btn:disabled {
  cursor: not-allowed;
  color: #9ca3af;
  background: #f3f4f6;
}
.pager-ellipsis {
  color: var(--muted);
}
.form-grid select[multiple] {
  height: auto;
  min-height: 116px;
  padding: 8px 10px;
}
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-modal.hidden { display: none; }
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
}
.confirm-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
  padding: 22px 22px 18px;
}
.confirm-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text);
}
.confirm-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.confirm-actions .ghost-btn,
.confirm-actions .primary-btn {
  flex: 1;
  width: 100%;
  height: 40px;
  margin-top: 0;
}
.integration-form input:disabled {
  opacity: .72;
  cursor: not-allowed;
  background: var(--soft);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(620px, 100vw);
  height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(15, 23, 42, .16);
  z-index: 40;
  display: flex;
  flex-direction: column;
  animation: drawerIn .22s ease both;
}
@keyframes drawerIn {
  from {
    opacity: .6;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .drawer {
    animation: none;
  }
}
.drawer-head {
  height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.drawer-head h3 {
  margin: 0;
}
.drawer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.drawer-body {
  padding: 18px;
  overflow: auto;
}
.drawer-json {
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  color: #dbeafe;
  background: #0f172a;
  border-radius: 8px;
}
.raw-fold {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft-2);
  padding: 0 12px 12px;
}
.raw-fold > summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}
.raw-fold > summary::-webkit-details-marker { display: none; }
.raw-fold[open] > summary { color: var(--text); }
.raw-fold .drawer-json { margin: 0; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.detail-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
}
.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.detail-item strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.drawer-section {
  margin-top: 16px;
}
.drawer-section h4 {
  margin: 0 0 10px;
  font-size: 15px;
}
.process-list {
  display: grid;
  gap: 8px;
}
.process-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
}
.process-item span {
  color: var(--muted);
}
.drawer-form {
  padding: 18px;
  overflow: auto;
}
.drawer-form .primary-btn {
  margin-top: 16px;
}
.lead-context {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft-2);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero-panel { min-height: 420px; }
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar-brand span,
  .nav-item { font-size: 0; }
  .nav-section-title { display: none; }
  .sidebar nav { gap: 4px; }
  .nav-item span { font-size: 17px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .config-grid { grid-template-columns: 1fr; }
  .grid-2 > .panel { min-height: 240px; }
  .user-stats-grid,
  .role-page-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-form-layout { grid-template-columns: 1fr; }
  .integration-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .integration-status div:nth-child(2) { border-right: 0; }
  .integration-status div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .integration-body { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .login-view {
    align-items: flex-start;
    padding: 112px 18px 24px;
  }
  .login-page-brand {
    top: 24px;
    left: 20px;
    right: 20px;
    font-size: 20px;
  }
  .login-page-brand strong {
    font-size: 1em;
    font-weight: 800;
  }
  .login-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
  }
  .login-hero-panel,
  .login-card { padding: 22px; }
  .login-card-head h2 { font-size: 20px; font-weight: 800; }
  .login-card .primary-btn { font-size: 20px; }
  .captcha-image-btn {
    flex: 0 0 108px;
    width: 108px;
  }
  .captcha-input-wrap input {
    font-size: 16px; /* 避免 iOS 聚焦放大 */
  }
  .login-hero-copy h2 { font-size: 26px; }
  .login-metrics { grid-template-columns: 1fr; }
  .content { padding: 24px 14px 14px; }
  .metric-grid { grid-template-columns: 1fr; }
  .page-title-with-actions {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .page-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .user-stats-grid,
  .role-page-list,
  .user-form-grid {
    grid-template-columns: 1fr;
  }
  .subpage-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .subpage-head .primary-btn {
    margin-left: auto;
  }
  .filters { grid-template-columns: 1fr; }
  .integration-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .integration-actions {
    width: 100%;
    justify-content: space-between;
  }
  .integration-status { grid-template-columns: 1fr; }
  .integration-status div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .integration-status div:last-child {
    border-bottom: 0;
  }
  .integration-form { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ===== Mobile shell (phone / WeChat / narrow viewport) — PC unchanged above ===== */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
  }

  .login-view {
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100dvh;
    padding: calc(88px + env(safe-area-inset-top, 0px)) 16px calc(28px + env(safe-area-inset-bottom, 0px));
  }
  .login-page-brand {
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: 16px;
    right: 16px;
    font-size: 18px;
  }
  .login-card-unified {
    width: 100%;
    margin: 0 auto;
  }
  .login-card {
    padding: 20px 18px 18px;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(20, 80, 145, .16);
  }
  .login-card-head {
    margin-bottom: 16px;
  }
  .login-card-head h2 {
    font-size: 22px;
  }
  .login-card input,
  .login-card .login-field input,
  .login-password-field input,
  .captcha-input-wrap input {
    font-size: 16px;
    min-height: 48px;
  }
  .login-password-toggle {
    width: 44px;
    height: 44px;
    right: 2px;
  }
  .login-password-toggle .login-eye-icon {
    width: 22px;
    height: 22px;
  }
  .login-password-toggle .iconfont {
    font-size: 20px;
  }
  .captcha-row {
    gap: 10px;
    align-items: stretch;
  }
  .captcha-image-btn {
    flex: 0 0 112px;
    width: 112px;
    min-height: 48px;
    border-radius: 8px;
    overflow: hidden;
  }
  .captcha-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .login-options {
    flex-wrap: wrap;
    gap: 10px;
  }
  .login-card .primary-btn {
    min-height: 48px;
    font-size: 17px;
    border-radius: 10px;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 84vw);
    z-index: 90;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 8px 0 28px rgba(8, 17, 31, .28);
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .app-shell.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .46);
    z-index: 80;
  }
  /* 覆盖 ≤1100px 的图标栏样式：手机抽屉必须显示菜单名 */
  .sidebar-brand {
    justify-content: flex-start;
    padding: 0 8px;
  }
  .sidebar-brand span,
  .sidebar-collapsed .sidebar-brand > span {
    display: inline;
    opacity: 1;
    width: auto;
    overflow: visible;
    font-size: 14px;
    font-weight: 700;
  }
  .nav-section-title,
  .sidebar-collapsed .nav-section-title {
    display: block;
  }
  .sidebar nav,
  .sidebar-collapsed .sidebar nav {
    gap: 14px;
  }
  .nav-item,
  .sidebar-collapsed .nav-item {
    justify-content: flex-start;
    gap: 10px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
  }
  .nav-item span,
  .sidebar-collapsed .nav-item span {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    font-size: 14px;
  }
  .workspace {
    min-width: 0;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding-left: 10px;
    padding-right: 10px;
    gap: 8px;
  }
  .topbar-left {
    min-width: 0;
    gap: 6px;
  }
  .topbar-left h1,
  .page-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-right {
    gap: 6px;
    flex-shrink: 0;
  }
  .sidebar-toggle {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .content {
    padding: 14px 12px calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .panel,
  .card,
  .table-wrap {
    border-radius: 10px;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    min-width: 640px;
  }
  .filters {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .drawer {
    width: min(100vw, 420px);
    max-width: 100%;
  }
  .confirm-card {
    width: min(92vw, 360px);
    margin: 0 16px;
  }
}

html.is-mobile .login-card input,
html.is-mobile .login-password-field input,
html.is-mobile .captcha-input-wrap input {
  font-size: 16px;
}

/* 客户端（含微信内置浏览器）侧栏抽屉始终显示菜单文字 */
html.is-mobile .sidebar-brand span {
  opacity: 1 !important;
  width: auto !important;
  overflow: visible !important;
  font-size: 14px !important;
}
html.is-mobile .nav-section-title {
  display: block !important;
}
html.is-mobile .nav-item {
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 0 12px !important;
  font-size: 14px !important;
}
html.is-mobile .nav-item span {
  font-size: 14px !important;
}
