/* ============================================================
   誉豪车险查询系统 - 全局样式（2026-07-28 视觉重做版）
   设计系统：
   - 主色 #2563eb（专业蓝），侧栏 #0f172a（深岩灰蓝）
   - 卡片：白底 + 12px 圆角 + 柔和阴影，无硬边框
   - 表格：浅色表头 + auto 布局 + 横向滚动容器 + pill 徽章
   硬性规定（见 需求与硬性规定.txt 三、前端UI规范）：
   - 只用原生 data-table，禁止 el-table 数据表格
   - 禁止 table-layout:fixed、禁止全局 el-card margin hack
   ============================================================ */

/* ===== 设计变量 ===== */
:root {
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  --sidebar-bg: #0f172a;
  --sidebar-active: rgba(37, 99, 235, 0.16);
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --content-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --border: #e2e8f0;
  --border-light: #eef2f7;
  --text-1: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #64748b;
  --info-soft: #f1f5f9;
  --primary-soft: #dbeafe;
}

/* ===== 全局基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif;
  background: var(--content-bg);
  color: var(--text-1);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; }

/* 启动闪屏：Vue 挂载前显示，挂载后自动被替换 */
.boot-splash {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff;
  font-size: 15px;
  letter-spacing: 2px;
}

/* ===== 登录页（fixed 全屏覆盖，防止 Vue 加载前露出主界面） ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
}
.login-box {
  width: 400px;
  padding: 44px 40px 36px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(2, 6, 23, 0.35);
}
.login-brand {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-header h2 { font-size: 22px; color: var(--text-1); margin-bottom: 6px; font-weight: 600; }
.login-header p { color: var(--text-4); font-size: 13px; }
.shake-animation { animation: shake 0.5s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}
.input-error :deep(.el-input__wrapper),
.input-error :deep(.el-input__wrapper):hover,
.input-error :deep(.el-input__wrapper.is-focus) {
  box-shadow: 0 0 0 1px var(--danger) inset;
}
.login-error-tip {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.login-attempts-tip { color: var(--text-4); font-size: 12px; text-align: center; padding: 4px 0; }
.login-footer { text-align: center; margin-top: 18px; color: var(--text-4); font-size: 12px; }

/* ===== 布局骨架 ===== */
.layout-container { height: 100vh; display: flex; }

/* --- 侧边栏：深岩灰蓝，无白缝（硬性规定：间距只由 main-content padding 控制） --- */
.sidebar {
  width: 200px;
  background: var(--sidebar-bg);
  overflow: hidden;
  transition: width 0.25s ease;
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
.sidebar.collapsed { width: 64px; }
.logo {
  height: 60px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  flex-shrink: 0;
}
.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar.collapsed .logo span.logo-text { display: none; }
.sidebar .el-menu {
  border-right: none;
  background: transparent;
  padding: 12px 10px;
  flex: 1;
}
.sidebar .el-menu-item {
  height: 44px;
  line-height: 44px;
  margin-bottom: 4px;
  border-radius: 8px;
  color: var(--sidebar-text);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar .el-menu-item:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--sidebar-text-hover);
}
.sidebar .el-menu-item.is-active {
  background: var(--sidebar-active);
  color: #60a5fa;
  font-weight: 500;
}
.sidebar.collapsed .el-menu-item span { display: none; }
.sidebar.collapsed .el-menu-item { justify-content: center; padding-left: 0 !important; padding-right: 0 !important; }
.toggle-sidebar-btn {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--sidebar-text-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.toggle-sidebar-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.sidebar.collapsed .toggle-sidebar-btn { font-size: 15px; }

/* --- 主区 --- */
.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}
.header-title { font-size: 16px; font-weight: 600; color: var(--text-1); }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  background: var(--info-soft);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
}
.user-chip .avatar-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.role-tag { color: var(--text-4); font-size: 12px; }
.logout-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}
.logout-btn:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* 硬性规定：卡片与主区间距只由这里的 padding 控制，禁止全局 el-card margin */
.main-content {
  flex: 1;
  padding: 24px;
  overflow: auto;
}
.main-content .el-card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}
.main-content .el-card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  color: var(--text-1);
}
.main-content .el-card__body { padding: 20px; }

/* ===== 通用 ===== */
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-header-title { font-weight: 600; font-size: 15px; color: var(--text-1); }
.card-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tip { font-size: 12px; color: var(--text-4); margin-top: 6px; }
.batch-title { font-size: 13px; color: var(--brand); font-weight: 600; margin-bottom: 8px; }
.batch-table { width: 100%; font-size: 13px; }
.batch-table .el-input { width: 100%; }
.batch-scroll { max-height: 400px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.batch-sep-row td { height: 10px; background: var(--info-soft); border-top: 2px solid var(--text-4); padding: 0; }
.points-info {
  color: var(--text-3);
  font-size: 13px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 500;
}

/* 原生下拉框：el-select 弹层在对话框内会被截断（见 BUG 记录），故用原生 select */
.native-select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-2);
  background: #fff;
}
.native-select:focus { outline: none; border-color: var(--brand); }

/* 搜索输入框（最近查询头部） */
.search-input {
  width: 200px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  transition: border-color 0.15s ease;
}
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 批量下载按钮 */
.btn-primary-plain {
  height: 32px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary-plain:hover:not(:disabled) { background: var(--brand-hover); }
.btn-primary-plain:disabled { opacity: 0.5; cursor: not-allowed; }
.muted-text { color: var(--text-4); font-size: 12px; }

/* ===== pill 徽章（状态/角色/类型统一，硬性规定） ===== */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger  { background: var(--danger-soft);  color: var(--danger); }
.pill-info    { background: var(--info-soft);    color: var(--info); }
.pill-primary { background: var(--primary-soft); color: var(--brand); }

/* 兼容旧类名（非表格处的彩色文字） */
.text-green { color: var(--success); font-weight: 600; }
.text-red { color: var(--danger); font-weight: 600; }
.text-success { color: var(--success); font-weight: 500; }
.text-warning { color: var(--warning); font-weight: 500; }
.text-danger { color: var(--danger); font-weight: 500; }
.text-info { color: var(--text-4); font-weight: 500; }

/* ===== Element Plus 细节修复 ===== */
.el-table th, .el-table td { padding: 10px 0 !important; box-sizing: border-box; }
.el-table .cell { padding-left: 12px !important; padding-right: 12px !important; box-sizing: border-box; }
.el-input__wrapper { box-sizing: border-box; }
.el-divider { margin: 16px 0 !important; }
.el-pagination { --el-pagination-button-bg-color: #fff; }

/* ===== 原生数据表格（硬性规定：data-table + auto 布局 + 滚动容器） ===== */
.table-wrap {
  width: 100%;
  /* 表格最大宽度：超宽屏不再无限拉伸，避免出现单列巨大空白 */
  max-width: 1500px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.data-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.data-table th {
  background: #f8fafc;
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}
/* 备注列：允许换行，窄屏不截断、宽屏不黑洞 */
.data-table td.td-remark {
  white-space: normal;
  word-break: break-all;
  line-height: 1.5;
}
/* 操作列：按钮多时允许折行，不再把表格顶出横向滚动条 */
.data-table td.td-actions {
  white-space: normal;
  line-height: 2;
}
.data-table tbody tr:last-child td { border-bottom: none; }
/* 硬性规定：斑马纹 + hover */
.data-table tbody tr:nth-child(even) { background: #fafbfd; }
.data-table tbody tr:hover { background: var(--brand-soft); }
/* 表格内的输入行（待提交列表）不吃斑马纹 */
.data-table.batch-table tbody tr:nth-child(even) { background: #fff; }
.data-table .cell-center { text-align: center; }
.data-table .cell-right { text-align: right; }

/* 个人中心：表单类卡片限宽，避免宽屏下大片空白 */
.profile-card { max-width: 720px; }

/* ===== 监控页 ===== */
.page-content .page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 15px;
}
.page-content .page-header span:last-child {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-4);
}
.stat-card-num { font-size: 32px; font-weight: 700; }
.stat-card-label { color: var(--text-3); font-size: 13px; margin-top: 6px; }
