/* ─── 基础重置 ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f1f5f9; color: #1e293b; }
a { text-decoration: none; color: inherit; }

/* ─── 变量 ──────────────────────────────────────────────── */
:root {
  --sidebar-w:    220px;
  --header-h:     56px;
  --sidebar-bg:   #1e1b4b;
  --sidebar-text: #a5b4fc;
  --sidebar-hover:#2e2a6e;
  --sidebar-active:#4f46e5;
  --primary:      #4f46e5;
  --primary-light:#e0e7ff;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --bg:           #f1f5f9;
  --card:         #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --muted:        #64748b;
}

/* ═══════════════════════════════════════════════════════════
   登录页
═══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
}
.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .icon { font-size: 48px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--muted); margin-top: 4px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color .2s;
}
.form-group input:focus { border-color: var(--primary); }

.btn-primary {
  width: 100%; padding: 12px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn-primary:hover   { background: #4338ca; }
.btn-primary:active  { transform: scale(.98); }
.btn-primary:disabled{ background: #a5b4fc; cursor: not-allowed; }

.login-error {
  margin-top: 14px; padding: 10px 14px;
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; color: var(--danger); font-size: 13px;
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   主应用布局
═══════════════════════════════════════════════════════════ */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ─── 侧边栏 ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-header .logo-icon { font-size: 26px; }
.sidebar-header .logo-text { color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-header .logo-sub  { color: var(--sidebar-text); font-size: 11px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-text); font-size: 14px;
  cursor: pointer; transition: all .15s; margin-bottom: 2px;
  user-select: none;
}
.nav-item:hover  { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item.locked { opacity: .45; cursor: not-allowed; }
.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }
.nav-item .lock-badge {
  margin-left: auto; font-size: 11px;
  background: rgba(255,255,255,.12); padding: 1px 6px; border-radius: 4px;
}
.nav-item.nav-group { font-weight: 600; }
.nav-item.nav-child {
  margin-left: 22px; font-size: 13px; padding: 8px 12px;
  border-left: 2px solid rgba(255,255,255,.12); border-radius: 0 8px 8px 0;
}
.nav-item.nav-child .nav-icon { font-size: 15px; width: 18px; }
.nav-divider { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 10px 8px; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sidebar-active);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.user-name  { color: #fff; font-size: 13px; font-weight: 500; }
.user-role  { color: var(--sidebar-text); font-size: 11px; }
.btn-logout {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--sidebar-text); font-size: 18px;
  padding: 4px; border-radius: 4px;
  transition: color .15s;
}
.btn-logout:hover { color: var(--danger); }

/* ─── 主内容区 ────────────────────────────────────────────── */
.main-area  { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-header {
  height: var(--header-h); flex-shrink: 0;
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px;
  gap: 8px;
}
.main-header .page-title { font-size: 17px; font-weight: 700; color: var(--text); }
.main-header .page-desc  { font-size: 13px; color: var(--muted); margin-left: 4px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.main-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ─── 卡片 ──────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: 12px;
  border: 1px solid var(--border); padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

/* ─── 统计数字 ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card  {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat-card.blue   { border-left: 4px solid var(--primary); }
.stat-card.green  { border-left: 4px solid var(--success); }
.stat-card.orange { border-left: 4px solid var(--warning); }

/* ─── 表格 ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  padding: 10px 14px; text-align: left;
  background: #f8fafc; border-bottom: 2px solid var(--border);
  font-weight: 600; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ─── 徽章 ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-blue   { background: var(--primary-light); color: var(--primary); }
.badge-gray   { background: #f1f5f9; color: var(--muted); }

/* ─── 按钮 ──────────────────────────────────────────────── */
.btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-blue   { background: var(--primary); color: #fff; }
.btn-blue:hover  { background: #4338ca; }
.btn-green  { background: var(--success); color: #fff; }
.btn-green:hover { background: #059669; }
.btn-red    { background: var(--danger); color: #fff; }
.btn-red:hover   { background: #dc2626; }
.btn-outline{ background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ─── 开关 ──────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle {
  position: relative; width: 40px; height: 22px;
  cursor: pointer; display: inline-block;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 22px;
  transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle.admin-toggle { cursor: not-allowed; opacity: .6; }

/* ─── 模态框 ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; visibility: hidden;
  transition: all .2s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  background: #fff; border-radius: 16px;
  width: 460px; max-width: 95vw;
  box-shadow: 0 25px 50px rgba(0,0,0,.2);
  transform: scale(.95); transition: transform .2s;
}
.modal-overlay.show .modal { transform: scale(1); }
.modal-header {
  padding: 20px 24px 16px;
  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; font-size: 20px; color: var(--muted); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── 表单 ──────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color .2s;
}
.field input:focus, .field select:focus { border-color: var(--primary); }

/* ─── 空状态 ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty-state .icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ─── 权限锁定提示 ────────────────────────────────────────── */
.locked-view {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; padding: 60px 20px; text-align: center;
}
.locked-view .lock-icon { font-size: 64px; margin-bottom: 16px; opacity: .4; }
.locked-view h2 { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.locked-view p  { color: var(--muted); font-size: 14px; }

/* ─── 滚动条 ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* ─── 工具类 ─────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--muted); }
.hidden { display: none !important; }
/* 券商TRS 异常告警（2026-06-11） */
.bk-warnbanner { background: #fff4e5; border: 1px solid #f5c97a; color: #b45309; padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.bk-warnrow td { background: #fff8f0; }
.bk-warn { color: #c62828; font-size: 12px; margin-left: 6px; }
/* 🔍核对 弹窗（2026-06-11） */
.bko-btn { border: 1px solid #cfe0f7; background: #eef4fd; color: #2d6cd0; border-radius: 6px; padding: 1px 7px; font-size: 11px; cursor: pointer; margin-left: 6px; }
.bko-btn:hover { background: #e0ecfb; }
.bko-box { background: #fff; border-radius: 12px; padding: 20px; width: 880px; max-width: 94vw; max-height: 90vh; overflow: auto; }
.bko-hd { display: flex; justify-content: space-between; align-items: center; }
.bko-sec { font-size: 13px; font-weight: 700; color: #33415c; margin: 14px 0 8px; }
.bko-bd { width: 100%; border-collapse: collapse; }
.bko-bd td { padding: 7px 10px; border-bottom: 1px solid #f0f3f8; font-size: 13px; font-variant-numeric: tabular-nums; }
.bko-bd tr.bko-sum td { background: #f4f8ff; font-weight: 700; color: #0f2742; border-top: 1px solid #d8e6fb; }
.bko-wrap { max-height: 320px; overflow: auto; border: 1px solid #eef1f5; border-radius: 8px; }
.bko-src { border-collapse: collapse; font-size: 12px; }
.bko-src td { padding: 4px 8px; border: 1px solid #f0f3f8; white-space: nowrap; color: #475569; font-variant-numeric: tabular-nums; }
.bko-hl { background: #d6f5e3 !important; color: #0f5132 !important; font-weight: 700; outline: 2px solid #34c77b; }
