/* ==========================================================================
   授权管理后台 · 设计系统
   纯原生 CSS，无构建、无外部字体/CDN 依赖；浅色主题，indigo 强调色。
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  --bg: #f5f6fa;
  --bg-deep: #eceef5;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --border: #e6e8ee;
  --border-strong: #d5d9e2;
  --text: #161a23;
  --text-2: #4b5563;
  --text-3: #8a91a0;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-active: #3730a3;
  --primary-soft: #eef2ff;
  --primary-soft-hover: #e4e9ff;
  --primary-border: #c9d2ff;

  --success: #047857;
  --success-soft: #ecfdf5;
  --success-border: #b3e8d4;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --warning-border: #fbe3a2;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fbc9c9;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --info-border: #bfe3f8;

  --radius-lg: 12px;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.08), 0 2px 8px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.18), 0 4px 12px rgba(16, 24, 40, 0.06);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.14);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Consolas,
    "Liberation Mono", Menlo, monospace;

  --sidebar-w: 244px;
  --topbar-h: 60px;
  --content-max: 1320px;
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

img,
svg {
  display: block;
}

::selection {
  background: rgba(79, 70, 229, 0.18);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 滚动条（Webkit） */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #d6d9e2;
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: #bcc1cf;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- 图标 ---------- */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 15px;
  height: 15px;
}

.icon-lg {
  width: 22px;
  height: 22px;
}

/* ---------- 通用工具 ---------- */
.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.muted {
  color: var(--text-3);
}

.text-2 {
  color: var(--text-2);
}

.text-danger {
  color: var(--danger);
}

.xs {
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

.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;
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 16px 0;
}

.app-root {
  min-height: 100vh;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-3);
  font-size: 13px;
}

.noscript {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
  color: var(--text);
  z-index: 999;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.06s ease;
  user-select: none;
}

.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-active);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: #c4c9d5;
  color: var(--text);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn-soft:hover:not(:disabled) {
  background: var(--primary-soft-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-danger-soft:hover:not(:disabled) {
  background: #fee7e7;
}

.btn-sm {
  height: 31px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: var(--radius-xs);
  gap: 5px;
}

.btn-sm .icon {
  width: 14px;
  height: 14px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  flex: none;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn.sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
}

.icon-btn.sm .icon {
  width: 15px;
  height: 15px;
}

.icon-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.is-loading {
  pointer-events: none;
}

/* 加载圈 */
.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner.dark {
  border-color: rgba(79, 70, 229, 0.2);
  border-top-color: var(--primary);
}

.spinner.lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-color: rgba(79, 70, 229, 0.18);
  border-top-color: var(--primary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 表单 ---------- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
}

.req {
  color: var(--danger);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.form-grid.one {
  grid-template-columns: minmax(0, 1fr);
}

.form-grid .span-2 {
  grid-column: span 2;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a91a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.input::placeholder,
.textarea::placeholder {
  color: #a9afbb;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #c4c9d5;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  cursor: not-allowed;
}

.input.mono {
  font-size: 13px;
  letter-spacing: 0.04em;
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 44px;
}

.input-suffix {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 30px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

.form-error .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.form-error[hidden] {
  display: none;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 2px;
}

.radio,
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.radio input,
.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

.search-box {
  position: relative;
  min-width: 220px;
  flex: 1 1 220px;
}

.search-box .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.search-box .input {
  padding-left: 34px;
}

/* ---------- 布局：侧边栏 + 顶栏 ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
  transition: transform 0.22s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #5b5bf0 0%, #4f46e5 55%, #4338ca 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.28);
  flex: none;
}

.brand-logo .icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.brand-text strong {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text);
  white-space: nowrap;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  transition: color 0.15s ease;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item:hover .icon {
  color: var(--text-2);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .icon {
  color: var(--primary);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.sidebar-foot {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
  flex: none;
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-toggle {
  display: none;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  min-width: 0;
}

.crumbs .crumb-sep {
  width: 13px;
  height: 13px;
  color: #c1c6d2;
}

.crumb-current {
  color: var(--text);
  font-weight: 550;
  white-space: nowrap;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.user-chip .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 26px 26px 48px;
}

.sidebar-scrim {
  display: none;
}

/* ---------- 页面标题 ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
}

.page-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.55;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.view-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-head h2,
.card-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--text);
}

.card-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-3);
}

.card-body {
  padding: 18px;
}

.card-body.tight {
  padding: 0;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- 统计卡 ---------- */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 15px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: #dcdfe8;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.stat-icon .icon {
  width: 17px;
  height: 17px;
}

.stat-icon.green {
  background: var(--success-soft);
  color: var(--success);
}

.stat-icon.red {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-icon.blue {
  background: var(--info-soft);
  color: var(--info);
}

.stat-icon.amber {
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-value {
  margin-top: 10px;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-foot {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-foot .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c8ccd6;
}

/* ---------- 仪表盘布局 ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.dist-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.dist-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dist-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.dist-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
}

.dist-name .tag {
  margin-left: 2px;
}

.dist-nums {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dist-bar {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #4f46e5);
  min-width: 2px;
  transition: width 0.4s ease;
}

.quick-card {
  background: linear-gradient(155deg, #eef2ff 0%, #f8f9ff 48%, #ffffff 100%);
  border-color: #dfe4ff;
}

.quick-card .card-body {
  padding: 18px;
}

.quick-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.quick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  box-shadow: var(--shadow-xs);
  flex: none;
}

.quick-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.quick-sub {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
}

.quick-actions .btn {
  justify-content: flex-start;
}

.tips-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--primary-border);
}

.tips-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
}

.tips-list .icon {
  width: 15px;
  height: 15px;
  color: var(--primary);
  margin-top: 1px;
}

/* 最近操作 */
.recent-list {
  display: flex;
  flex-direction: column;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.65;
  flex: none;
}

.recent-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.recent-action {
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
}

.recent-target {
  font-size: 12.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.recent-time {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- 工具栏 / 筛选 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.filter-label {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.filter .select,
.filter .input {
  width: auto;
  min-width: 124px;
  height: 35px;
  font-size: 13px;
}

.filter .select {
  min-width: 132px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ---------- 表格 ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: #fafbff;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.target-cell {
  display: inline-block;
  max-width: 280px;
  vertical-align: middle;
}

.data-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-primary {
  color: var(--text);
  font-weight: 500;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cell-sub {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.45;
}

.cell-sub.truncate {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.key-cell code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
}

.key-cell .icon-btn {
  opacity: 0;
  transition: opacity 0.12s ease, background 0.15s ease;
}

.data-table tbody tr:hover .key-cell .icon-btn,
.key-cell .icon-btn:focus-visible {
  opacity: 1;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.tag.plain {
  font-family: var(--font);
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  opacity: 0.85;
}

.badge-neutral {
  background: var(--surface-3);
  border-color: var(--border);
  color: #616b7c;
}

.badge-success {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.badge-info {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: var(--info);
}

.badge-primary {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* 设备计数 */
.device-count {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-size: 13px;
}

.device-count .icon {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}

.device-count.full {
  color: var(--warning);
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pager-info {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pager-pos {
  font-size: 12.5px;
  color: var(--text-2);
  min-width: 88px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-3);
}

.pager-size .select {
  width: auto;
  height: 31px;
  padding: 0 26px 0 9px;
  font-size: 12.5px;
  background-position: right 7px center;
}

/* ---------- 空状态 / 错误 / 骨架 ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 52px 20px;
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--surface-3);
  color: var(--text-3);
  margin-bottom: 4px;
}

.empty-icon .icon {
  width: 22px;
  height: 22px;
}

.empty-title {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-2);
}

.empty-sub {
  font-size: 12.5px;
  color: var(--text-3);
  max-width: 420px;
  line-height: 1.6;
}

.empty .btn {
  margin-top: 8px;
}

.empty.error .empty-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.load-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px;
  text-align: center;
}

.load-error-text {
  font-size: 13px;
  color: var(--text-2);
  max-width: 460px;
  line-height: 1.6;
}

.load-error-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: 6px;
  padding: 2px 7px;
}

.skeleton {
  display: flex;
  flex-direction: column;
}

.sk {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef0f5 25%, #f7f8fb 50%, #eef0f5 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

@keyframes sk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sk-row {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--border);
}

.sk-row:last-child {
  border-bottom: none;
}

.sk-row .sk {
  flex: 1;
}

.sk-row .sk.w-sm { max-width: 90px; }
.sk-row .sk.w-md { max-width: 150px; }

.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.sk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- 行操作菜单 ---------- */
.row-menu-pop {
  position: fixed;
  z-index: 90;
  min-width: 186px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.row-menu-pop.in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.menu-item .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.menu-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.menu-item:hover .icon {
  color: var(--text-2);
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item.danger .icon {
  color: var(--danger);
}

.menu-item.danger:hover {
  background: var(--danger-soft);
}

.menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: none;
}

.menu-sep {
  height: 1px;
  background: var(--border);
  margin: 5px 4px;
}

/* ---------- 模态框 ---------- */
.modal-root[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 18px 28px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(2px);
  overflow-y: auto;
  animation: fade-in 0.14s ease;
}

.modal {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: modal-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.modal-sm {
  max-width: 424px;
}

.modal-lg {
  max-width: 680px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-head-text {
  min-width: 0;
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.35;
  color: var(--text);
}

.modal-head p {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.modal-head .icon-btn {
  margin-top: -2px;
  margin-right: -4px;
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-foot .btn-ghost {
  background: var(--surface);
}

.modal-open {
  overflow: hidden;
}

.confirm-text {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
  white-space: pre-line;
}

.confirm-text strong {
  color: var(--text);
  font-weight: 600;
}

.modal-warning {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  font-size: 12.5px;
  line-height: 1.6;
}

.modal-warning .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex: none;
}

.modal-warning.danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.modal-warning.info {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: var(--info);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 生成结果卡密列表 */
.key-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-result-meta {
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}

.key-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.key-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.key-line:last-child {
  border-bottom: none;
}

.key-line code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.toast.out {
  animation: toast-out 0.18s ease forwards;
}

.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--text-3);
}

.toast-success::before { background: var(--success); }
.toast-error::before { background: var(--danger); }
.toast-info::before { background: var(--primary); }

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex: none;
  background: var(--surface-3);
  color: var(--text-2);
}

.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-info .toast-icon { background: var(--primary-soft); color: var(--primary); }

.toast-icon .icon {
  width: 15px;
  height: 15px;
}

.toast-body {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.toast-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.toast-msg {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
  word-break: break-word;
}

.toast-title + .toast-msg {
  margin-top: 1px;
}

.toast-close {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex: none;
  margin-top: 1px;
}

.toast-close:hover {
  background: var(--surface-3);
  color: var(--text-2);
}

.toast-close .icon {
  width: 13px;
  height: 13px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  background: var(--surface);
}

.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px clamp(40px, 6vw, 84px);
  background: radial-gradient(120% 120% at 10% 0%, #6366f1 0%, #4f46e5 42%, #3f38c9 100%);
  color: #fff;
}

.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.login-brand::before {
  width: 520px;
  height: 520px;
  right: -180px;
  top: -160px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 68%);
}

.login-brand::after {
  width: 380px;
  height: 380px;
  left: -140px;
  bottom: -160px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 70%);
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 460px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(6px);
  margin-bottom: 28px;
}

.brand-mark .icon {
  width: 27px;
  height: 27px;
  stroke-width: 1.7;
}

.login-brand h1 {
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.login-brand-tag {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.82);
  max-width: 400px;
}

.login-points {
  margin-top: 34px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.login-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.9);
}

.login-points .icon {
  width: 17px;
  height: 17px;
  color: rgba(255, 255, 255, 0.75);
}

.login-brand-foot {
  position: absolute;
  left: clamp(40px, 6vw, 84px);
  bottom: 34px;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--surface);
}

.login-card {
  width: 100%;
  max-width: 384px;
  animation: login-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes login-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card h2 {
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
}

.login-sub {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-3);
}

.login-form {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-form .btn-block {
  height: 42px;
  font-size: 14px;
  margin-top: 2px;
}

.login-hint {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
}

.login-error-guide {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 10px;
  line-height: 1.6;
}

.shake {
  animation: shake 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* 登录右侧移动端品牌条 */
.login-mobile-brand {
  display: none;
}

/* ---------- 应用管理 ---------- */
.secret-cell {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.secret-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.app-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 650;
  flex: none;
  border: 1px solid var(--primary-border);
}

/* ---------- 支付回调 ---------- */
.hooks-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.hook-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.hook-row:last-child {
  border-bottom: none;
}

.hook-label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
  padding-top: 6px;
  flex: none;
  width: 96px;
}

.hook-value {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hook-value code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  word-break: break-all;
  line-height: 1.5;
  max-width: 100%;
}

.hook-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 12px;
  margin: 0 18px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--info-soft);
  border: 1px solid var(--info-border);
  color: var(--info);
}

.hook-note.warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.hook-note .icon {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
}

.code-block-wrap {
  position: relative;
  margin: 0 18px 18px;
}

.code-block-wrap:first-of-type {
  margin-top: 16px;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 8px;
  font-size: 12px;
  color: var(--text-3);
}

.code-block {
  margin: 0;
  padding: 14px 16px;
  background: #0f172a;
  color: #dbe3f4;
  border-radius: var(--radius-sm);
  border: 1px solid #1e293b;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

.code-block .tok-key { color: #93c5fd; }
.code-block .tok-str { color: #86efac; }
.code-block .tok-cmd { color: #f0abfc; }

.hook-form {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hook-result {
  margin: 0 18px 18px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hook-result-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
}

.result-pre {
  margin: 0;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  overflow: auto;
  max-height: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 审计日志 ---------- */
.detail-cell {
  max-width: 360px;
}

.detail-toggle summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.detail-toggle summary::-webkit-details-marker {
  display: none;
}

.detail-toggle summary::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 2px;
  margin-bottom: 2px;
}

.detail-toggle[open] summary::after {
  transform: rotate(-135deg);
  margin-bottom: -1px;
}

.detail-toggle pre {
  margin: 7px 0 0;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 420px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .grid-stats,
  .skeleton-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .content {
    padding: 22px 20px 44px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .layout.nav-open .sidebar {
    transform: translateX(0);
  }

  .layout.nav-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.36);
    z-index: 35;
    animation: fade-in 0.16s ease;
  }

  .main {
    margin-left: 0;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .topbar {
    padding: 0 16px;
  }

  .recent-target {
    max-width: 200px;
  }
}

@media (max-width: 760px) {
  .content {
    padding: 18px 14px 40px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid .span-2 {
    grid-column: span 1;
  }

  .grid-stats,
  .skeleton-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter {
    justify-content: space-between;
  }

  .filter .select,
  .filter .input {
    flex: 1;
    min-width: 0;
  }

  .search-box {
    min-width: 0;
    flex: 1 1 auto;
  }

  .toolbar-right {
    margin-left: 0;
    justify-content: flex-end;
  }

  .topbar-right .user-chip span {
    display: none;
  }

  .topbar-right .user-chip {
    padding: 0 9px;
  }

  .topbar-right .btn span {
    display: none;
  }

  .topbar-right .btn {
    padding: 0 10px;
  }

  .modal-backdrop {
    padding: 4vh 12px 20px;
  }

  .modal-body {
    max-height: calc(100vh - 190px);
  }

  .hook-row {
    flex-direction: column;
    gap: 8px;
  }

  .hook-label {
    padding-top: 0;
    width: auto;
  }

  .hook-value {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: minmax(0, 1fr);
    background: var(--bg);
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    background: transparent;
    padding: 32px 18px;
    min-height: 100vh;
    align-items: center;
  }

  .login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 30px 24px;
  }

  .login-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
  }

  .login-mobile-brand .brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .login-mobile-brand .brand-logo .icon {
    width: 19px;
    height: 19px;
  }

  .login-mobile-brand strong {
    font-size: 14px;
    color: var(--text);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}


/* 仅屏幕阅读器 / 自动填充可见（用于隐藏用户名输入框） */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


/* ---------------------------------------------------------------
 * 隐藏属性兜底：.form-field / .radio-group 等使用 display:flex，
 * 会覆盖浏览器默认的 [hidden]{display:none}，此处显式兜底，
 * 保证“有效天数 / 指定日期”“封禁原因”等条件字段真正隐藏。
 * ------------------------------------------------------------- */
[hidden] {
  display: none !important;
}
