/* ============================================================
   商标侵权查询 SaaS 平台 — 全局样式
   ============================================================ */

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

:root {
  --sidebar-w: 220px;
  --header-h: 52px;
  --primary: #1890ff;
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --text: #333;
  --text-muted: #999;
  --border: #e5e5e5;
  --bg: #f5f7fa;
  --white: #fff;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #0f3460;
  --radius: 6px;
}

body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }

/* ── 布局 ── */
.layout { display: flex; min-height: 100vh; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text); flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.sidebar h2 { padding: 20px 16px 12px; font-size: 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 8px; }
.sidebar nav a { display: block; padding: 10px 16px; color: var(--sidebar-text); text-decoration: none; border-left: 3px solid transparent; transition: .15s; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: var(--sidebar-active); border-left-color: var(--primary); color: #fff; }
.sidebar nav a.nav-admin { margin-top: 24px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.header { height: var(--header-h); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.credits-badge { background: var(--primary); color: #fff; padding: 4px 10px; border-radius: 20px; font-size: 13px; }
.content {
  padding: 24px;
  width: 100%;
  max-width: 100%;
  min-height: calc(100vh - var(--header-h));
  box-sizing: border-box;
}

.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px 8px; }

/* ── 按钮 ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; font-size: 14px; transition: .15s; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #096dd9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-default { background: var(--white); border-color: var(--border); color: var(--text); }
.btn-default:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-link { background: none; color: var(--primary); border: none; padding: 4px 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ── 表单 ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--white); color: var(--text); transition: border-color .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(24,144,255,.15); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── 卡片 ── */
.card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 8px 18px; cursor: pointer; border: none; background: none; font-size: 14px; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: .15s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── 标签 ── */
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag-pending { background: #e5e5e5; color: #666; }
.tag-processing { background: #e6f7ff; color: #1890ff; }
.tag-completed { background: #f6ffed; color: #52c41a; }
.tag-failed { background: #fff1f0; color: #f5222d; }
.tag-retrying { background: #fff7e6; color: #fa8c16; }
.tag-stopped { background: #f5f5f5; color: #999; }
.tag-credits { background: #f9f0ff; color: #722ed1; }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; font-size: 14px; }
.alert-info { background: #f0f5ff; border-color: #adc6ff; color: #1d39c4; }
.alert-success { background: #f6ffed; border-color: #b7eb8f; color: #389e0d; }
.alert-danger { background: #fff1f0; border-color: #ffa39e; color: #cf1322; }
.alert-warning { background: #fffbe6; border-color: #ffe58f; color: #d48806; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafafa; }

/* ── 模态框（置顶于所有内容之上） ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
  overflow-y: auto;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 90%;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 24px;
  max-width: 960px;
  flex-shrink: 0;
  margin: 0 auto;
}

/* 响应式：窄屏时 modal 以屏幕左上角为基准定位，不超出视口 */
@media (max-width: 768px) {
  .modal-overlay {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 0;
  }
  .modal {
    width: calc(100vw - 240px); /* 减去侧边栏 220px + 间距 */
    max-width: calc(100vw - 240px);
    margin-left: 220px;         /* 紧贴侧边栏右边 */
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
@media (max-width: 480px) {
  .modal {
    width: 100vw;
    margin-left: 0;
    min-height: 100vh;
    max-height: 100vh;
  }
}

/* ── 搜索单条结果 ── */
.result-item { background: var(--white); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.result-title { font-size: 15px; font-weight: 600; }
.result-tags { display: flex; gap: 8px; align-items: center; }
.risk-high { color: #f5222d; font-weight: 600; }
.risk-medium { color: #fa8c16; font-weight: 600; }
.risk-low { color: #52c41a; }
.risk-failed { color: #999; font-weight: 600; }
.result-meta { font-size: 13px; color: var(--text-muted); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.result-meta span { display: flex; gap: 6px; }
.result-meta strong { color: var(--text); min-width: 90px; }

/* ── 批量上传 ── */
.batch-section { margin-bottom: 20px; }
.batch-column-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.batch-column-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; cursor: pointer; transition: .15s; font-size: 13px; }
.batch-column-chip input { display: none; }
.batch-column-chip:hover { border-color: var(--primary); color: var(--primary); }
.batch-column-chip input:checked + span { color: var(--primary); }
.batch-preview-area { background: var(--bg); border-radius: var(--radius); padding: 12px 16px; margin-top: 10px; font-size: 13px; color: var(--text-muted); }
.batch-preview-area .batch-preview-line { display: block; padding: 2px 0; }

/* ── 批量任务列表 ── */
.batch-active-title { font-weight: 600; margin-bottom: 10px; }
.batch-active-list { list-style: none; }
.batch-active-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.batch-progress-bar { height: 6px; background: var(--border); border-radius: 3px; flex: 1; min-width: 80px; overflow: hidden; }
.batch-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; }

/* ── 登录页（双栏布局） ── */
.login-page { background: var(--sidebar-bg); min-height: 100vh; }
.login-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  width: 100%;
}
.login-brand {
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 56px;
  background: linear-gradient(160deg, #1a1a2e 0%, #0f3460 60%, #16213e 100%);
  color: #fff;
  position: relative; overflow: hidden;
  min-height: 100vh;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}
.login-brand-logo {
  font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 16px; letter-spacing: -0.5px;
  position: relative; z-index: 1;
}
.login-brand-tagline { font-size: 17px; color: rgba(255,255,255,0.85); margin-bottom: 36px; line-height: 1.6; position: relative; z-index: 1; }
.login-brand-features { list-style: none; display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 1; }
.login-brand-features li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: rgba(255,255,255,0.8); }
.login-brand-features li::before {
  content: '✓'; display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; background: rgba(24,144,255,0.3); border-radius: 50%;
  font-size: 11px; color: #69c0ff; flex-shrink: 0;
}
.login-brand-footer { margin-top: auto; padding-top: 36px; font-size: 12px; color: rgba(255,255,255,0.4); position: relative; z-index: 1; }
.login-form-panel {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 48px 40px;
  background: #fff;
  width: 100%;
}
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-size: 22px; font-weight: 700; color: #1a1a2e; margin-bottom: 28px; text-align: center; }
.login-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--border); }
.login-tab { flex: 1; padding: 8px; text-align: center; cursor: pointer; border: none; background: none; font-size: 15px; border-bottom: 2px solid transparent; color: var(--text-muted); margin-bottom: -2px; transition: .15s; }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.login-box .form-group { margin-bottom: 20px; }
.login-back-home { text-align: center; margin-top: 20px; font-size: 13px; }
.login-back-home a { color: var(--text-muted); text-decoration: none; transition: color .15s; }
.login-back-home a:hover { color: var(--primary); }
@media (max-width: 768px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-form-panel { padding: 40px 24px; justify-content: flex-start; padding-top: 60px; }
  .login-box { max-width: 100%; }
}

/* ── 历史页（商品卡片网格） ── */
.history-card {
  background: var(--white); border-radius: 10px; border: 1px solid var(--border);
  padding: 0; overflow: hidden; cursor: pointer; transition: box-shadow .2s, border-color .2s, transform .15s;
  display: flex; flex-direction: column;
}
.history-card:hover {
  border-color: var(--primary); box-shadow: 0 4px 16px rgba(24,144,255,.13);
  transform: translateY(-2px);
}
.history-card-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-card-header .history-card-type-badge { align-self: flex-start; }
.history-card-header-row {
  display: flex; align-items: center; gap: 12px;
}
.history-card-header-row .history-card-title-text { flex: 1; min-width: 0; }
.history-card-title-text { display: flex; flex-direction: column; min-width: 0; }
.history-card-thumb {
  width: 64px; height: 64px;
  border-radius: 6px;
  background: #f0f1f3 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23bfbfbf'><path d='M21 19V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2zM8.5 13.5l2.5 3 3.5-4.5L19 18H5l3.5-4.5z'/></svg>") center/40% no-repeat;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.history-card-thumb.thumb-missing { background-color: #fafbfc; }
.history-card-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.history-card-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
  margin-bottom: 6px;
}
.history-card-type-badge.batch { background: #e6f7ff; color: #1890ff; }
.history-card-type-badge.text { background: #f6ffed; color: #52c41a; }
.history-card-type-badge.image { background: #fff7e6; color: #fa8c16; }
.history-card-title {
  font-size: 14px; font-weight: 600; color: #333; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 4px;
}
.history-card-subtitle {
  font-size: 12px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-card-body { padding: 12px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.history-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #999; }
.history-card-time { display: flex; align-items: center; gap: 4px; }
.history-card-tags { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.history-card-footer {
  padding: 8px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); background: #fafbfc;
}
.history-card-risk {
  font-size: 12px; font-weight: 600;
}
.history-card-footer .risk-pill {
  font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
}
.history-card-footer .risk-pill.risk-high { color: #c00; background: #ffe5e5; }
.history-card-footer .risk-pill.risk-medium { color: #d07000; background: #fff4e0; }
.history-card-footer .risk-pill.risk-low { color: #2a7a2a; background: #f0f8f0; }
.history-card-actions { display: flex; gap: 6px; }
.history-detail-btn {
  font-size: 12px; padding: 3px 10px; border-radius: 4px; border: 1px solid var(--primary);
  background: transparent; color: var(--primary); cursor: pointer; transition: .15s;
}
.history-detail-btn:hover { background: var(--primary); color: #fff; }

/* 工具栏 */
.history-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 12px; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}
.history-per-page { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #666; }
.history-per-page select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; background: #fff; font-size: 13px; }
.history-total { font-size: 13px; color: #999; }

/* 分页器 */
.enhanced-pager { display: flex; align-items: center; gap: 4px; padding: 16px 0; flex-wrap: wrap; justify-content: center; }
.pager-btn, .pager-num { padding: 4px 12px; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; color: #555; font-size: 13px; cursor: pointer; background: #fff; transition: .15s; }
.pager-btn:hover, .pager-num:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager-current { padding: 4px 12px; background: var(--primary); color: #fff; border-radius: 4px; font-size: 13px; }
.pager-ellipsis { color: #bbb; padding: 0 4px; }
.pager-jump { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #999; }
.pager-jump-input { width: 52px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; text-align: center; font-size: 13px; }
.pager-jump-btn { padding: 3px 10px; background: var(--primary); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }
.pager-info { padding: 8px; text-align: center; color: #999; font-size: 13px; }

/* 弹窗 */
.modal-actions { display: flex; gap: 8px; margin-right: auto; }
.modal { max-width: 960px; }
.modal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 17px; font-weight: 700; color: #1a1a2e; }
.uspto-link { font-size: 12px; font-weight: normal; color: #0066cc; text-decoration: none; margin-left: 8px; }
.uspto-link:hover { text-decoration: underline; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* 风险词详情弹窗（更深层级） */
#word-detail-overlay { z-index: 10001; }
#word-detail-overlay .modal { max-width: 700px; }
@media (max-width: 768px) {
  #word-detail-overlay .modal { width: calc(100vw - 240px); max-width: calc(100vw - 240px); margin-left: 220px; border-radius: 0; }
}
@media (max-width: 480px) {
  #word-detail-overlay .modal { width: 100vw; margin-left: 0; }
}

/* 批量摘要条 */
.batch-summary-bar { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; color: #555; background: #f5f7fa; padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; }
.batch-summary-bar strong { font-size: 18px; }

/* 批量详情表格 */
.batch-detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.batch-detail-table th, .batch-detail-table td { padding: 8px 12px; border: 1px solid var(--border); }
.batch-detail-table th { background: #f5f7fa; font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
.batch-detail-table tbody tr:hover td { background: #f9fbff; }
.batch-detail-table .risk-row-\u9ad8 td { background: #fff5f5 !important; }
.batch-detail-table .risk-row-\u4e2d td { background: #fffbf0 !important; }
.batch-detail-table .risk-row-high td { background: #fff5f5 !important; }
.batch-detail-table .risk-row-medium td { background: #fffbf0 !important; }
.batch-detail-table .risk-row-failed td { background: #fafafa !important; color: #999; }
.batch-query-cell { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-detail-table .col-row { width: 60px; max-width: 60px; text-align: center; }
.batch-detail-table .col-query { max-width: 480px; }

/* 风险词详情弹窗 */
.word-section { margin-bottom: 20px; }
.word-section-title { font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 6px; margin-bottom: 10px; }
.risk-high-title { background: #ffe5e5; color: #c00; }
.risk-medium-title { background: #fff4e0; color: #d07000; }
.risk-low-title { background: #f0f8f0; color: #2a7a2a; }
.word-detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.word-detail-table th, .word-detail-table td { padding: 7px 12px; border: 1px solid var(--border); }
.word-detail-table th { background: #f5f7fa; font-weight: 600; }
.word-detail-table tbody tr:hover td { background: #f9fbff; }
.row-badge { display: inline-block; background: #e6f7ff; color: #1890ff; padding: 1px 7px; border-radius: 3px; font-size: 11px; margin: 1px; }

/* 可点击的风险词链接 */
.tm-link { text-decoration: none; cursor: pointer; font-weight: 600; }
.tm-link.risk-high { color: #f5222d; }
.tm-link.risk-high:hover { text-decoration: underline; }
.tm-link.risk-medium { color: #fa8c16; }
.tm-link.risk-medium:hover { text-decoration: underline; }
.tm-link.risk-low { color: #52c41a; }
.tm-link.risk-low:hover { text-decoration: underline; }

/* 商标详情弹窗 */
.tm-detail-img-wrapper { text-align: center; padding: 16px 0 8px; }
.tm-detail-img { max-width: 160px; max-height: 100px; object-fit: contain; border-radius: 6px; border: 1px solid var(--border); background: #f5f7fa; }
.tm-detail-meta { font-size: 13px; color: #666; padding: 8px 16px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tm-detail-meta .risk-badge, .tm-detail-meta .similarity-badge { margin-left: auto; font-size: 12px; padding: 2px 10px; border-radius: 20px; font-weight: 600; }
.tm-detail-meta .risk-high { background: #ffe0e0; color: #c00; }
.tm-detail-meta .risk-medium { background: #fff3e0; color: #e65100; }
.tm-detail-meta .risk-low { background: #e8f5e9; color: #2e7d32; }
.tm-detail-meta .similarity-badge { background: #e3f2fd; color: #1565c0; }
.tm-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tm-detail-row { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; min-width: 0; }
.tm-detail-row.full-width { grid-column: 1 / -1; }
.tm-detail-label { font-size: 12px; font-weight: 600; color: #888; letter-spacing: 0.3px; }
.tm-detail-value { font-size: 14px; color: #222; line-height: 1.6; word-break: break-word; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; transition: all 0.2s; position: relative; }
.tm-detail-row:hover .tm-detail-value { -webkit-line-clamp: unset; display: block; overflow: visible; }
.tm-detail-value strong { color: var(--primary); }
.tm-detail-link { color: var(--primary); text-decoration: none; word-break: break-all; }
.tm-detail-link:hover { text-decoration: underline; }
.tm-detail-img-wrapper { margin-bottom: 16px; text-align: center; }
.tm-detail-img { max-width: 220px; max-height: 220px; border: 1px solid var(--border); border-radius: 6px; padding: 4px; background: #fff; }

/* TRO 案件进程时间轴 */
.tm-detail-block { margin-top: 16px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: #fafbfc; }
.tm-detail-block-title { font-size: 13px; font-weight: 700; color: #333; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px dashed #e0e0e0; }
.tm-process-list { list-style: none; padding: 0; margin: 0; position: relative; }
.tm-process-list::before { content: ''; position: absolute; left: 90px; top: 6px; bottom: 6px; width: 2px; background: #d0d7de; }
.tm-process-list li { position: relative; padding: 6px 0 6px 110px; min-height: 28px; line-height: 1.6; }
.tm-process-list li::before { content: ''; position: absolute; left: 84px; top: 12px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #2e7dff; box-shadow: 0 0 0 3px #fafbfc; }
.tm-process-date { position: absolute; left: 0; top: 6px; width: 78px; font-size: 12px; color: #888; font-variant-numeric: tabular-nums; }
.tm-process-name { font-size: 14px; color: #222; font-weight: 600; }
.tm-process-desc { font-size: 12px; color: #666; margin-top: 2px; padding-left: 0; }

/* TRO 列表案件号链接 */
.tm-case-link { color: var(--primary); text-decoration: none; font-weight: 600; border-bottom: 1px dashed transparent; transition: all 0.15s; }
.tm-case-link:hover { color: #1a5fcc; border-bottom-color: #1a5fcc; }
@media (max-width: 700px) {
  .tm-detail-grid { grid-template-columns: 1fr; }
  .tm-process-list::before { left: 70px; }
  .tm-process-list li { padding-left: 90px; }
  .tm-process-list li::before { left: 64px; }
  .tm-process-date { width: 58px; font-size: 11px; }
}

/* 摘要统计卡片 */
.batch-word-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 600px) { .batch-word-summary { grid-template-columns: repeat(2, 1fr); } }
.summary-stat { background: #f5f7fa; border-radius: 10px; padding: 16px 12px; text-align: center; }
.summary-num { font-size: 32px; font-weight: 800; line-height: 1.1; color: #333; }
.summary-num.risk-high { color: #f5222d; }
.summary-num.risk-medium { color: #d07000; }
.summary-num.risk-low { color: #52c41a; }
.summary-label { font-size: 13px; color: #666; margin-top: 4px; }
.summary-sub { font-size: 11px; color: #999; }
.risk-mark { background: #fff3a0; color: #c00; padding: 0 2px; border-radius: 2px; font-weight: 600; }

.table-wrapper { overflow-x: auto; max-height: 480px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }

/* 响应式网格 */
#history-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; padding: 4px; }
@media (max-width: 1400px) { #history-list { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1100px) { #history-list { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { #history-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { #history-list { grid-template-columns: 1fr; } }

.p-3 { padding: 16px; }
.p-4 { padding: 20px; }

/* ── 管理后台 ── */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.admin-stat { background: var(--white); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.admin-stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.admin-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.config-section { margin-bottom: 20px; }
.config-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.config-row label { min-width: 180px; font-weight: 500; }
.config-row input { max-width: 200px; }

/* ── 分页 ── */
.pager { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 20px; }

/* ── DLQ 错误类型标签 ── */
.dlq-error-type { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.dlq-error-type-permanent { background: #fde2e2; color: #c0392b; border: 1px solid #e74c3c; }
.dlq-error-type-transient { background: #fff4e6; color: #d35400; border: 1px solid #f39c12; }
.dlq-error-type-rate_limit { background: #fdebd0; color: #b9770e; border: 1px solid #e67e22; }
.dlq-error-type-warning { background: #fcf3cf; color: #9a7d0a; border: 1px solid #f1c40f; }

/* DLQ 筛选 chips */
.dlq-chip { display: inline-block; padding: 2px 8px; margin: 2px 4px 2px 0; background: #f5f5f5; border-radius: 12px; font-size: 12px; color: #555; }

/* DLQ 详情弹窗 */
.dlq-detail-section { margin-bottom: 18px; }
.dlq-detail-section h4 { margin-bottom: 8px; font-size: 14px; color: #1a1a2e; border-left: 3px solid var(--primary); padding-left: 8px; }
.dlq-info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dlq-info-table th { background: #fafafa; padding: 6px 10px; text-align: left; border: 1px solid var(--border); color: #888; font-weight: 500; width: 100px; }
.dlq-info-table td { padding: 6px 10px; border: 1px solid var(--border); }
.dlq-json { background: #fafafa; border: 1px solid var(--border); padding: 8px; border-radius: 4px; font-size: 12px; max-height: 200px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.dlq-json-small { background: #fafafa; border: 1px solid var(--border); padding: 4px 6px; border-radius: 3px; font-size: 11px; margin: 4px 0 0; white-space: pre-wrap; word-break: break-all; max-height: 80px; overflow: auto; }
.dlq-history { list-style: none; padding: 0; margin: 0; }
.dlq-history li { padding: 6px 0; border-bottom: 1px dashed #eee; }
.dlq-history li:last-child { border-bottom: none; }

/* DLQ 趋势条 */
.dlq-trend-bar { transition: opacity .2s; }
.dlq-trend-bar:hover { opacity: 1 !important; }

/* 系统参数 hint */
.config-hint { color: var(--text-muted); font-size: 11px; margin-top: 4px; margin-left: 4px; }
.config-input-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; text-decoration: none; color: var(--text); transition: .15s; }
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── 工具 ── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.flex { display: flex; }
.flex-gap { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }

/* ── 响应式 ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 16px; }
  .header { padding: 0 16px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .history-grid { grid-template-columns: 1fr; }
}

/* ── 管理弹窗 ── */
#credit-overlay, #delete-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 999; display: flex; align-items: center; justify-content: center; }
.popup-box { background: #fff; border-radius: 10px; padding: 24px; width: 420px; max-width: 90%; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.popup-header { font-size: 16px; font-weight: 600; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid #e5e5e5; }
.popup-body { display: flex; flex-direction: column; gap: 14px; }
.popup-row { display: flex; align-items: center; gap: 12px; }

/* 操作审计日志：详情列 3 行截断 + 结果列降宽 */
.oplog-detail { max-width: 280px; font-size: 12px; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.oplog-th-result, table th.oplog-th-result, table td:nth-child(6) { width: 90px; max-width: 90px; }

/* 积分调整弹窗：充值/赠送 单选 */
.popup-radio-row { display: flex; gap: 18px; padding: 4px 0 2px; }
.popup-radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.popup-radio input { accent-color: #2563eb; }

/* 用户详情弹窗 */
.user-detail-box { width: 760px; max-width: 95%; }
.user-detail-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border, #e5e5e5); margin-bottom: 14px; }
.ud-tab {
  background: none; border: 0; padding: 10px 20px; cursor: pointer;
  font-size: 14px; color: #666; border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}
.ud-tab:hover { color: #2563eb; }
.ud-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.user-detail-body { min-height: 200px; }
.ud-summary { font-size: 13px; color: #666; margin-bottom: 10px; padding: 0 2px; }
.ud-type {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  background: #f0f3f7; color: #555; font-size: 11px; font-family: monospace;
}
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.popup-row label { min-width: 80px; font-weight: 500; color: #555; font-size: 14px; }
.popup-row > span, .popup-row > input[type="text"] { flex: 1; }
.popup-stepper { display: flex; align-items: center; gap: 6px; flex: 1; }
.popup-stepper input { text-align: center; max-width: 100px; }
.popup-stepper button { padding: 4px 12px; font-size: 16px; background: #f5f5f5; border: 1px solid #d9d9d9; border-radius: 4px; cursor: pointer; }
.popup-stepper button:hover { background: #e6e6e6; }
.popup-result { margin-top: 4px; padding-top: 12px; border-top: 1px dashed #e5e5e5; }
.result-preview { font-size: 22px; font-weight: 700; color: #1890ff; }
.result-positive { color: #52c41a; }
.result-negative { color: #f5222d; }
.popup-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e5e5; }
.popup-error { background: #fff1f0; color: #cf1322; padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 8px; border: 1px solid #ffa39e; }

/* ── Toast 通知 ── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 9999; opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #52c41a; color: #fff; }
.toast-danger { background: #f5222d; color: #fff; }

/* ── 配置页样式 ── */
.config-input-group { display: flex; align-items: center; gap: 8px; }
.config-unit { color: #888; font-size: 13px; white-space: nowrap; }
.config-note { background: #fffbe6; border: 1px solid #ffe58f; border-radius: 6px; padding: 8px 12px; font-size: 13px; color: #ad6800; margin: 12px 0; }

/* ── 管理员详情弹窗 ── */
.modal-wide { max-width: 960px; }
.risk-failed { color: #999; font-weight: 600; }

/* 使用情况卡片的网格布局 */
#atm-content .p-3 { padding: 0; }
#atm-content .batch-summary-bar { margin: 0 0 16px; }

/* 管理员使用情况列表 */
.ud-history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding: 4px; }
@media (max-width: 900px) { .ud-history-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
@media (max-width: 600px) { .ud-history-list { grid-template-columns: 1fr; } }

/* 图片放大提示框 */
.image-tooltip {
  position: fixed;
  display: none;
  background: #fff;
  border: 2px solid #333;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  padding: 10px;
  z-index: 10000;
  max-width: 50vw;
}
.image-tooltip img {
  max-width: 50vw;
  max-height: 50vh;
  display: block;
  border-radius: 4px;
}
.image-tooltip-title {
  margin-top: 8px;
  font-size: 13px;
  color: #333;
  text-align: center;
  word-break: break-word;
}

/* 文本放大提示框 */
.keyword-tooltip {
  position: fixed;
  display: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  padding: 10px 14px;
  z-index: 10000;
  max-width: 400px;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  word-break: break-word;
}

/* 分页器在详情弹窗里的样式 */
.ud-pager-wrap { display: flex; justify-content: center; margin-top: 16px; }
.ud-pager-wrap .pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
