/* ============ 全局 ============ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, .1), 0 4px 6px -4px rgba(15, 23, 42, .05);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ============ 登录页 ============ */
.login-page {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #4f46e5 100%);
  overflow: hidden;
}
.login-bg::before, .login-bg::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.login-bg::before { width: 600px; height: 600px; top: -200px; right: -100px; }
.login-bg::after { width: 400px; height: 400px; bottom: -150px; left: -100px; }
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.35);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.login-brand .brand-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 12px rgba(37,99,235,.3);
}
.login-brand .brand-icon svg { width: 26px; height: 26px; }
.login-brand h1 { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.login-brand p { font-size: 11px; color: var(--text-muted); letter-spacing: .5px; margin-top: 2px; }
.login-form .field { margin-bottom: 18px; }
.login-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.input-wrap { position: relative; }
.input-wrap svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted);
}
.input-wrap input {
  width: 100%; height: 44px; padding: 0 14px 0 42px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.login-error {
  color: var(--danger); font-size: 13px; min-height: 20px;
  margin: -4px 0 12px;
}
.login-hint {
  margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--border);
  text-align: center; font-size: 12px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.login-hint code {
  background: var(--bg); padding: 3px 7px; border-radius: 4px;
  font-size: 11px; color: var(--primary-dark); font-family: "SF Mono", Consolas, monospace;
}
.login-hint .dot { color: var(--text-muted); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 4px 10px rgba(37,99,235,.25); }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: #cbd5e1; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger-light); color: #dc2626; }
.btn-danger:hover:not(:disabled) { background: #fecaca; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); cursor: pointer; transition: all .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ============ 布局 ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 248px;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 30;
}
.sidebar-brand {
  height: 68px; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon.sm {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.brand-icon.sm svg { width: 20px; height: 20px; }
.sb-title { color: #fff; font-size: 15px; font-weight: 700; }
.sb-sub { font-size: 11px; color: #64748b; margin-top: 1px; }
.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: #475569; padding: 14px 12px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm); color: var(--sidebar-text);
  text-decoration: none; font-size: 14px; transition: all .15s;
}
.nav-item svg { width: 18px; height: 18px; color: #64748b; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item:hover svg { color: #cbd5e1; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 500; }
.nav-item.active svg { color: #fff; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  background: rgba(255,255,255,.15); color: #fff; border-radius: 10px;
  font-size: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}
.nav-badge.danger { background: var(--danger); }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: rgba(255,255,255,.04); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #64748b; margin-top: 1px; }
.user-card .icon-btn { color: #64748b; flex-shrink: 0; }
.user-card .icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

.main { margin-left: 248px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 68px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-date { font-size: 13px; color: var(--text-secondary); }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 4px; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
.content { padding: 24px 28px 40px; flex: 1; }

/* ============ 通用组件 ============ */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; }
.page-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 26px; height: 26px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: #d97706; }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-info .stat-label { font-size: 13px; color: var(--text-secondary); }
.stat-info .stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.stat-info .stat-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* 图表区 */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.chart-title { font-size: 15px; font-weight: 600; margin-bottom: 20px; }
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 80px; font-size: 12px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 22px; background: var(--bg); border-radius: 4px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; min-width: 2px; }
.bar-value { width: 30px; font-size: 12px; font-weight: 600; text-align: right; flex-shrink: 0; }

.line-chart { position: relative; height: 180px; }
.line-chart svg { width: 100%; height: 100%; overflow: visible; }

.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.donut svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center .num { font-size: 26px; font-weight: 700; }
.donut-center .lbl { font-size: 11px; color: var(--text-secondary); }
.legend { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-item .legend-name { color: var(--text-secondary); flex: 1; }
.legend-item .legend-value { font-weight: 600; }

/* 表格 */
.table-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.table-toolbar { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box input {
  height: 34px; width: 240px; padding: 0 12px 0 34px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit;
}
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.filter-select {
  height: 34px; padding: 0 30px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.toolbar-spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
.domain-name { font-weight: 600; color: var(--text); }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; color: var(--text-secondary); }
.cell-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* 徽章 */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { background: var(--success-light); color: #15803d; }
.badge.pending { background: var(--warning-light); color: #b45309; }
.badge.rejected { background: var(--danger-light); color: #dc2626; }
.badge.expired { background: var(--purple-light); color: #7c3aed; }
.badge.revoked { background: #f1f5f9; color: #64748b; }
.badge.role-admin { background: var(--primary-light); color: var(--primary-dark); }
.badge.role-tenant { background: #f1f5f9; color: #475569; }
.badge.warn-tag { background: var(--warning-light); color: #b45309; }

/* 分页 */
.pagination { padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); }
.page-info { font-size: 12px; color: var(--text-secondary); }
.page-btns { display: flex; gap: 4px; }
.page-btn { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; color: var(--text); }
.page-btn:hover:not(:disabled) { background: var(--bg); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 空状态 */
.empty { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty svg { width: 48px; height: 48px; margin-bottom: 12px; color: #cbd5e1; }
.empty p { font-size: 14px; }

/* 列表项（概览） */
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f1f5f9; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.activity-item .activity-text { flex: 1; font-size: 13px; }
.activity-item .activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ============ 弹窗 ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 500px; max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column; animation: slideUp .2s;
}
@keyframes slideUp { from { transform: translateY(10px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.modal.lg { max-width: 640px; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; display: flex; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-group .req { color: var(--danger); }
.form-control {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-control { height: 80px; padding: 10px 12px; resize: vertical; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.radio-group { display: flex; gap: 10px; }
.radio-card {
  flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s; text-align: center;
}
.radio-card:hover { border-color: var(--primary); }
.radio-card.selected { border-color: var(--primary); background: var(--primary-light); }
.radio-card .radio-title { font-weight: 600; font-size: 13px; }
.radio-card .radio-desc { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }

/* 详情展示 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-item label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.detail-item .val { font-size: 13px; font-weight: 500; word-break: break-all; }
.info-box { background: var(--primary-light); border: 1px solid #bfdbfe; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12px; color: #1e40af; margin-bottom: 16px; }
.info-box.warn { background: var(--warning-light); border-color: #fde68a; color: #92400e; }

/* ============ Toast ============ */
.toast-root { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 400px; padding: 12px 16px;
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary); display: flex; align-items: center; gap: 10px;
  font-size: 13px; animation: toastIn .25s;
}
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast svg { width: 18px; height: 18px; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--primary); }

/* ============ API 调用模块 ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 10px 18px; border: none; background: none; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit;
  display: flex; align-items: center; gap: 6px; transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-count { background: var(--bg); padding: 1px 7px; border-radius: 10px; font-size: 11px; color: var(--text-secondary); }
.tab.active .tab-count { background: var(--primary-light); color: var(--primary); }

.method-tag {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 700; font-family: "SF Mono", Consolas, monospace;
}
.method-get { background: var(--success-light); color: #15803d; }
.method-post { background: var(--primary-light); color: var(--primary-dark); }
.method-put, .method-patch { background: var(--warning-light); color: #b45309; }
.method-delete { background: var(--danger-light); color: #dc2626; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #cbd5e1; border-radius: 20px; transition: .2s; }
.slider::before { content: ''; position: absolute; height: 14px; width: 14px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }

.event-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-item { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.check-item:hover { background: var(--bg); }
.check-item input { accent-color: var(--primary); cursor: pointer; }

/* ============ 深色主题 ============ */
[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --primary-light: #1e3a5f;
  --success: #4ade80;
  --success-light: #14532d;
  --warning: #fbbf24;
  --warning-light: #78350f;
  --danger: #f87171;
  --danger-light: #7f1d1d;
  --purple: #a78bfa;
  --purple-light: #4c1d95;
  --bg: #0f172a;
  --surface: #1e293b;
  --sidebar-bg: #020617;
  --sidebar-text: #94a3b8;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.5);
}
[data-theme="dark"] .card, [data-theme="dark"] .table-card,
[data-theme="dark"] .stat-card, [data-theme="dark"] .modal {
  background: var(--surface);
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: var(--bg); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .login-page { background: var(--sidebar-bg); }

/* ============ 补充组件 ============ */
.stat-mini { padding: 14px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.stat-mini .label { font-size: 12px; color: var(--text-secondary); }
.stat-mini .value { font-size: 22px; font-weight: 600; margin-top: 4px; }
.code-block { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; white-space: pre-wrap; }
.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv-list dt { color: var(--text-secondary); }
.kv-list dd { font-weight: 500; }
.timeline-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline-item:last-child { border-bottom: none; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .topbar-date { display: none; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; }
  .table-card { overflow-x: auto; }
  table { min-width: 700px; }
  .search-box input { width: 100%; }
}

/* ============ 开放平台 / 审批流 ============ */
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 4px 0; }
.checkbox-line input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.modal-lg { max-width: 760px; width: 92%; }

.node-chip {
  display: inline-block; padding: 3px 9px; border-radius: 12px;
  background: var(--purple-light); color: #6d28d9; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.node-editor { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: var(--surface); }
.node-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.node-editor-body { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.node-editor-body label { white-space: nowrap; color: var(--text-secondary); }
.node-editor-body .form-control { min-width: 0; }

.flow-step { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.flow-step-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.flow-step-approvers { display: flex; flex-direction: column; gap: 6px; padding-left: 4px; }
.approver-line { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.flow-arrow { text-align: center; color: var(--text-muted); font-size: 16px; line-height: 1.4; }

/* ============ 真实域名归属校验 ============ */
.badge.ok { background: var(--success-light); color: #15803d; }
.badge.danger { background: var(--danger-light); color: #dc2626; }
.badge.muted { background: #f1f5f9; color: #64748b; }
.verify-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface); }
.verify-panel-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.verify-detail { margin-top: 10px; padding: 8px 10px; background: var(--bg); border-radius: 6px; font-size: 12px; color: var(--text-secondary); word-break: break-word; }
.info-box code.mono { background: var(--bg); padding: 1px 4px; border-radius: 4px; }

/* ============ 授权证书 ============ */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cert-mini { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: linear-gradient(135deg, var(--surface), var(--bg)); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.cert-mini:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.cert-mini::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--warning), #d4af37); }
.cert-mini-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cert-mini-no { font-size: 11px; color: var(--text-muted); }
.cert-mini-domain { font-size: 19px; font-weight: 700; color: var(--primary); margin: 14px 0 6px; word-break: break-all; }
.cert-mini-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
.cert-mini-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 12px; gap: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.verify-res { border-radius: var(--radius-sm); padding: 14px 16px; font-size: 13px; }
.verify-res.valid { background: var(--success-light); border: 1px solid #bbf7d0; color: #15803d; }
.verify-res.invalid { background: var(--danger-light); border: 1px solid #fecaca; color: #b91c1c; }
.verify-res.invalid span { display: block; margin-top: 4px; }
.verify-res-head { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 12px; }
.verify-res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.verify-res-grid label { display: block; font-size: 11px; color: #4d7c0f; opacity: .8; margin-bottom: 2px; }

.modal-lg { max-width: 760px; }
.cert-paper { position: relative; border: 3px double #b8912f; background: linear-gradient(135deg, #fdfbf4, #fff); padding: 30px 36px; color: #1a2b4a; min-height: 440px; }
.cert-watermark { position: absolute; right: 24px; bottom: 12px; font-size: 150px; color: rgba(184,145,47,.07); line-height: 1; }
.cert-inner { position: relative; z-index: 1; }
.cert-seal-top { display: flex; align-items: center; gap: 8px; color: #b8912f; font-weight: 700; font-size: 14px; }
.cert-seal-top svg { width: 22px; height: 22px; }
.cert-title { text-align: center; font-size: 30px; letter-spacing: 8px; margin: 18px 0 4px; }
.cert-subtitle { text-align: center; font-size: 10px; letter-spacing: 3px; color: #a98b3a; margin-bottom: 18px; }
.cert-body-text { text-align: center; font-size: 13px; color: #4a5a72; }
.cert-domain { text-align: center; font-size: 27px; font-weight: 700; color: #1a4d9e; margin: 12px 0 20px; word-break: break-all; }
.cert-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; font-size: 13px; padding: 0 12px; }
.cert-fields label { display: block; font-size: 11px; color: #8a97ab; margin-bottom: 2px; }
.cert-number-row { text-align: center; margin-top: 20px; font-size: 12px; color: #5a6a82; }
.cert-number-row span { font-weight: 700; color: #1a2b4a; }
.cert-verify-hint { text-align: center; font-size: 10px; color: #93a0b3; margin-top: 8px; word-break: break-all; }
.cert-qr { position: absolute; right: 28px; bottom: 28px; z-index: 2; }
.cert-qr-svg { width: 68px; height: 68px; background: #fff; }
.cert-qr-svg .qr-d rect { fill: #1a2b4a; }
.cert-qr-svg .qr-f { fill: #1a2b4a; }
.cert-qr-svg .qr-b { fill: #fff; }

