/* ============================================================
   统一平台扩展样式 — 模块导航、多端适配、OCR面板与全端响应式系统
   ============================================================ */

/* 顶部左侧区域 (品牌 + 模块主导航左对齐并列) */
.header-left-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  min-width: 0;
}

/* 顶部模块主导航栏 (严格单行横向排布，不折行) */
.nav-modules {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  background: rgba(0, 0, 0, 0.22);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  flex-shrink: 0;
}

.nav-modules::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.nav-module-btn {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-module-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.nav-module-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* 全屏主视图容器 */
.module-view {
  display: none;
  width: 100%;
  height: 100%;
}

.module-view.active {
  display: flex;
  flex: 1;
  height: calc(100vh - 64px);
  overflow: hidden;
  animation: fadeIn 0.2s ease-in-out;
}

/* OCR 通用上下分栏面板 (方便上下比对原图与识别结果) */
.ocr-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 14px;
  gap: 14px;
  background: var(--bg-primary);
  box-sizing: border-box;
  overflow-y: auto;
}

.ocr-top {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.ocr-bottom {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-md);
  flex: 1;
  min-height: 260px;
}

/* 兼容旧类名 */
.ocr-left, .ocr-right {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-md);
}

/* 拖拽上传与图片展示区 (根据图片自适应高度，支持拖拽平移) */
.dropzone {
  width: 100%;
  min-height: 180px;
  max-height: 480px;
  border: 2px dashed #475569;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.dropzone.has-image {
  border: 1px solid var(--border-color);
  background: #080d1a;
  cursor: grab;
  padding: 10px;
}

.dropzone.is-dragging {
  cursor: grabbing !important;
}

.dropzone:hover, .dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.dropzone-icon {
  font-size: 40px;
  color: #64748b;
  margin-bottom: 8px;
  transition: var(--transition);
}

.dropzone:hover .dropzone-icon {
  color: #38bdf8;
  transform: translateY(-4px);
}

.dropzone-preview-img {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
}

.dropzone.is-dragging .dropzone-preview-img {
  cursor: grabbing !important;
}

/* 字段编辑网格 (上下结构下支持3-4列横向展开) */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  padding: 4px 2px;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-item.field-item-full {
  grid-column: 1 / -1;
}

.field-item.field-item-half {
  grid-column: span 2;
}

.field-item label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.field-item input, .field-item textarea, .field-item select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition);
  width: 100%;
  box-sizing: border-box;
}

.field-item input:focus, .field-item textarea:focus, .field-item select:focus {
  border-color: #38bdf8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* 预览区与编辑器 */
.preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow: hidden;
}

.preview-content {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-y: auto;
  font-family: "SimSun", "Songti SC", "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text-main);
}

/* 外语译文全部强制使用 Times New Roman 字体 */
.doc-trans-foreign,
.doc-trans-foreign *,
.doc-trans-foreign .doc-clause-hd,
.doc-trans-foreign .doc-sheet-title,
.doc-frame-paper[data-lang]:not([data-lang="zh"]),
.doc-frame-paper[data-lang]:not([data-lang="zh"]) *,
.doc-frame-paper[data-lang]:not([data-lang="zh"]) .doc-clause-hd,
.doc-frame-paper[data-lang]:not([data-lang="zh"]) .doc-sheet-title {
  font-family: 'Times New Roman', Times, 'Songti SC', serif !important;
}

[data-theme="dark"] .preview-content.paper-white {
  background: #ffffff !important;
  color: #1e293b !important;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

/* 状态徽章 */
.badge-pill {
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-blue { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-green { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-red { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.5); }
.badge-amber { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }

/* 天眼查核验异常红标与一键更正卡片 */
.field-item.has-mismatch {
  border: 1.5px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.07) !important;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.22);
  transition: all 0.2s ease;
}

.field-item.has-match {
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.tyc-diff-box {
  margin-top: 6px;
  font-size: 11px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tyc-diff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tyc-diff-text {
  color: #fca5a5;
  word-break: break-all;
  line-height: 1.4;
}

.btn-apply-tyc {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-apply-tyc:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

/* 模态框增强 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 650px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeIn 0.2s ease-in-out;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-primary);
}

/* Toast 浮层提示 */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.toast-info { background: #0284c7; }
.toast-success { background: #059669; }
.toast-warning { background: #d97706; }
.toast-danger { background: #dc2626; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   多端与多屏幕尺寸响应式适配 (Responsive Media Queries)
   ══════════════════════════════════════════════════════════════ */

/* 中屏幕与平板 (1024px 及以下) */
@media (max-width: 1024px) {
  .app-header {
    height: auto;
    min-height: 58px;
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .brand-subtitle {
    display: none;
  }

  .nav-modules {
    max-width: 100%;
    order: 3;
    width: 100%;
  }

  .header-actions,
  .header-actions-stacked {
    margin-left: auto;
  }

  .module-view.active {
    height: calc(100vh - 106px);
  }

  .sidebar-panel {
    width: 320px;
    min-width: 290px;
  }

  .ocr-container {
    padding: 10px;
    gap: 10px;
  }
}

/* 手机与小屏幕设备 (768px 及以下) */
@media (max-width: 768px) {
  html, body {
    overflow-y: auto !important;
    height: auto !important;
    max-height: none !important;
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .brand-info h1 {
    font-size: 15px;
  }

  .ai-toolbar-group {
    display: none !important; /* 移动端折叠次要AI工具栏 */
  }

  .module-view.active {
    height: auto !important;
    overflow: visible !important;
  }

  .app-container {
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
  }

  .sidebar-panel {
    width: 100% !important;
    max-width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color);
    height: auto !important;
    overflow: visible !important;
  }

  .sidebar-content {
    overflow: visible !important;
    padding: 12px;
  }

  .ocr-container {
    flex-direction: column !important;
    height: auto !important;
    padding: 10px;
  }

  .ocr-left, .ocr-right {
    height: auto !important;
    overflow: visible !important;
  }

  .dropzone {
    min-height: 180px;
  }

  .preview-panel {
    height: auto !important;
    overflow: visible !important;
  }

  .preview-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    height: auto;
    padding: 8px;
  }

  .preview-scroll-viewport {
    height: auto !important;
    overflow: visible !important;
    padding: 10px 4px !important;
  }

  .preview-content.paper-white {
    padding: 18px !important;
    margin: 10px auto !important;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .toast {
    width: 100%;
    box-sizing: border-box;
    font-size: 12px;
  }

  .modal-box {
    width: 95vw;
    margin: 10px;
  }
}

/* 高DPI屏幕支持 (Retina & 4K) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  canvas {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* ══════════════════════════════════════════════════════════════════
   客户全流程档案与卷宗卡片样式 (view-customers)
   ══════════════════════════════════════════════════════════════════ */
.customer-stat-tab {
  user-select: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.customer-stat-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.6) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
}

.customer-stat-tab.active {
  border-color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.05) !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25), 0 6px 20px rgba(0, 0, 0, 0.25) !important;
}

.customer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.customer-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(56, 189, 248, 0.4);
}

.customer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.customer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.customer-files-row {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
  position: relative;
  overflow: visible;
  padding-top: 4px;
}

.customer-file-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0 4px 0 0;
  overflow: visible;
  box-sizing: border-box;
}

.customer-file-pill:hover {
  filter: brightness(1.15);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

.file-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.file-label-short {
  display: inline-block;
  font-weight: 600;
  white-space: nowrap;
}

/* 优雅浮动气泡提示 (绝对定位，不破坏文档流，彻底消除抖动) */
.file-pill-floating-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 7px 12px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 9999;
  white-space: nowrap;
  text-align: left;
}

.file-pill-floating-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
}

.customer-file-pill:hover .file-pill-floating-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tooltip-file-name {
  font-family: monospace;
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  margin-bottom: 2px;
}

.tooltip-file-meta {
  font-size: 11px;
  color: #94a3b8;
}

/* 固定精确定位的删除图标按钮 */
.btn-file-delete {
  border: none;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 11px;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.65;
}

.customer-file-pill:hover .btn-file-delete {
  opacity: 1;
}

.btn-file-delete:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  transform: scale(1.15);
}

.file-badge-id { background: rgba(37, 99, 235, 0.15); color: #60a5fa; border: 1px solid rgba(37, 99, 235, 0.3); }
.file-badge-passport { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.file-badge-contract { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.file-badge-declaration { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }
.file-badge-social { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.file-badge-invoice { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.file-badge-bank { background: rgba(2, 132, 199, 0.18); color: #38bdf8; border: 1px solid rgba(2, 132, 199, 0.4); }
.file-badge-edu { background: rgba(99, 102, 241, 0.18); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.4); }
.file-badge-empty { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); border: 1px dashed var(--border-color); cursor: default; }

.customer-quick-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.customer-quick-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* ══════════════════════════════════════════════════════════════════
   增值税电子发票高保真预览 (invoice-paper / einv-*)
   完全对应 invoice_renderer.py 坐标系 PAGE_W=595.28 PAGE_H=396.85
   ══════════════════════════════════════════════════════════════════ */
.invoice-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

/* 发票纸张容器: 对应 595×397pt 横向页面，白色背景 */
.invoice-paper {
  width: 100%;
  max-width: 840px;
  background: #ffffff;
  color: #1a1a1a;
  border-radius: 3px;
  padding: 16px 18px 14px 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  font-family: "SimSun", "宋体", "Microsoft YaHei", serif;
  font-size: 11px;
  box-sizing: border-box;
  position: relative;
  border: 1px solid #ddd;
}

/* ─── 区域1: 顶部行 ─── */
.einv-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

/* 左: 二维码 (对应 QR 18.4,17→75.1,73.7 ≈56×57pt) */
.einv-qr-box {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

/* 中: 大标题区 (对应 "电子发票(普通发票)" x=192.93 y=39.93 fs=20pt) */
.einv-title-block {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.einv-title-text {
  font-family: "KaiTi", "楷体", "STKaiti", serif;
  font-size: 20px;
  font-weight: 700;
  color: #800000; /* C_DARK_RED = (0.502,0,0) = #800000 */
  letter-spacing: 1px;
  line-height: 1.2;
  margin-bottom: 3px;
}

/* 双横线 + 印章 (对应 y=51/53.86 双线, 印章cx=294 cy=50.5) */
.einv-title-deco {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.einv-deco-line {
  flex: 1;
  height: 1.5px;
  background: #800000;
  min-width: 20px;
}

/* 印章 (SEAL_CENTER=(294,50.5) SEAL_W=85 SEAL_H=57, 椭圆形红印) */
.einv-seal-circle {
  width: 70px;
  height: 48px;
  border: 2px solid rgba(206,32,39,0.8); /* C_SEAL_RGB #CE2027 */
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(206,32,39,0.85);
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1.3;
}
.einv-seal-line1, .einv-seal-line2, .einv-seal-line3 {
  font-size: 7px;
  letter-spacing: 0.3px;
  display: block;
  text-align: center;
}

/* 右: 发票号码/日期 (x=438~481 y=39.74/56.74) */
.einv-meta-block {
  text-align: right;
  flex-shrink: 0;
  font-size: 10.5px;
  color: #333;
  line-height: 1.9;
}
.einv-meta-row { white-space: nowrap; }
.einv-meta-label { color: #800000; font-weight: 600; margin-right: 2px; }
.einv-meta-value { color: #111; font-weight: 500; }

/* ─── 区域2: 购/销方信息 ─── */
/* 对应 y=85→147, 整行边框 border-top + 左右竖线 */
.einv-party-row {
  display: flex;
  align-items: stretch;
  border: 1px solid #800000;
  margin-bottom: 0;
  font-size: 10.5px;
}

/* 竖排标签 (x=16.92 购/销 各5字, fs=8.48) */
.einv-party-label {
  width: 16px;
  min-width: 16px;
  text-align: center;
  color: #800000;
  font-weight: 700;
  font-size: 9px;
  padding: 6px 2px;
  line-height: 1.45;
  background: #fffaf8;
  border-right: 1px solid #800000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 购/销方内容区 */
.einv-party-content {
  flex: 1;
  padding: 6px 10px;
  min-width: 0;
}

.einv-border-left {
  border-left: 1px solid #800000;
}

.einv-party-field {
  line-height: 1.75;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.einv-party-key {
  color: #800000;
  font-size: 9.5px;
}
.einv-party-val { color: #111; }
.einv-mono {
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ─── 区域3: 明细表 ─── */
/* 对应 y=147→272, 8列, 栏头 y=158.79 */
.einv-detail-table {
  width: 100%;
  border-collapse: collapse;
  border-left: 1px solid #800000;
  border-right: 1px solid #800000;
  border-bottom: 1px solid #800000;
  font-size: 10.5px;
}

.einv-th-cell {
  border: 1px solid #800000;
  padding: 4px 5px;
  color: #800000;
  font-weight: 700;
  text-align: center;
  background: #fffaf8;
  font-size: 10px;
  white-space: nowrap;
}

.einv-data-cell {
  border: 1px solid #800000;
  padding: 3px 5px;
  color: #1a1a1a;
  font-size: 10.5px;
  vertical-align: middle;
}

.einv-data-row td { height: 22px; }
.einv-empty-row td { height: 19px; border: 1px solid #800000; }

.einv-center { text-align: center; }
.einv-right { text-align: right; font-family: "Courier New", monospace; }
.einv-bold { font-weight: 700; }

/* 合计行 (y=268.241) */
.einv-sum-row td { background: #fffaf8; }
.einv-sum-label {
  text-align: center;
  color: #800000;
  font-weight: 700;
  letter-spacing: 6px;
  font-size: 10.5px;
  border: 1px solid #800000;
  padding: 4px 5px;
}

/* ─── 区域4: 价税合计 ─── */
/* 对应 y=272→294.80, 分隔线 x=160.15 */
.einv-tax-row {
  display: flex;
  align-items: center;
  border-left: 1px solid #800000;
  border-right: 1px solid #800000;
  border-bottom: 1px solid #800000;
  font-size: 10.5px;
  min-height: 26px;
}

.einv-tax-label {
  padding: 4px 8px;
  color: #800000;
  font-weight: 700;
  font-size: 10px;
  white-space: nowrap;
  border-right: 1px solid #800000;
  background: #fffaf8;
  min-width: 90px;
  text-align: center;
}

/* 大写区 (x=178.43 y=285.865, 占~27% 宽度) */
.einv-tax-upper {
  flex: 1.5;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 11px;
  color: #111;
  border-right: 1px solid #800000;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ⊗ 圆圈叉号 (对应 _draw_plus_sign_circle cx=171.27 cy=281.98) */
.einv-circle-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  border: 1.2px solid #111;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 700;
  color: #111;
  line-height: 1;
  flex-shrink: 0;
}

/* 小写区 (x=440.8 y=277.1) */
.einv-tax-lower {
  padding: 4px 10px;
  text-align: right;
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}
.einv-small-label { color: #800000; font-size: 9.5px; }
.einv-tax-num { font-family: "Courier New", monospace; font-size: 12px; font-weight: 700; color: #111; }

/* ─── 区域5: 备注 ─── */
/* 对应 y=294.80→351.50, 标签竖排 x=17.08 */
.einv-remark-row {
  display: flex;
  align-items: stretch;
  border-left: 1px solid #800000;
  border-right: 1px solid #800000;
  border-bottom: 1px solid #800000;
  min-height: 48px;
}

.einv-remark-label {
  width: 16px;
  text-align: center;
  color: #800000;
  font-weight: 700;
  font-size: 9px;
  padding: 6px 2px;
  line-height: 1.45;
  background: #fffaf8;
  border-right: 1px solid #800000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.einv-remark-content {
  flex: 1;
  padding: 6px 10px;
  font-size: 10.5px;
  color: #333;
  vertical-align: top;
}

/* ─── 区域6: 底部开票人 ─── */
/* 对应 y=375.64/375.94 */
.einv-footer-row {
  margin-top: 6px;
  font-size: 10.5px;
  color: #555;
  padding: 0 2px;
}
.einv-footer-label { color: #800000; font-weight: 600; }
.einv-footer-val { color: #111; margin-left: 2px; }

/* ─── 兼容旧版(保留) ─── */
.invoice-header { position: relative; text-align: center; margin-bottom: 16px; }
.invoice-header-title { font-size: 22px; font-weight: 700; color: #8B2500; letter-spacing: 4px; display: inline-block; border-top: 2px solid #8B2500; border-bottom: 2px solid #8B2500; padding: 4px 20px; }
.invoice-top-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: #8B2500; margin-bottom: 8px; font-weight: 600; }
.invoice-table { width: 100%; border-collapse: collapse; border: 1.5px solid #8B2500; font-size: 11.5px; margin-bottom: 10px; }
.invoice-table th, .invoice-table td { border: 1px solid #8B2500; padding: 5px 7px; color: #2b2b2b; }
.invoice-table th { color: #8B2500; font-weight: 600; text-align: center; background: #fffcf8; }
.einv-table { width: 100%; border-collapse: collapse; border: 1px solid #800000; font-size: 11px; }
.einv-th { border: 1px solid #800000; padding: 5px 6px; color: #800000; font-weight: 700; text-align: center; background: #fffaf8; }
.einv-td { border: 1px solid #800000; padding: 5px 7px; color: #1a1a1a; vertical-align: middle; }
.einv-num { text-align: right; font-family: "Courier New", monospace; }
.einv-label-cell { width: 26px; text-align: center; vertical-align: middle; color: #800000; font-weight: 700; font-size: 10px; background: #fffaf8; border-right: 1px solid #800000; padding: 5px 2px; line-height: 1.5; }
.einv-info-cell { padding: 7px 10px; vertical-align: middle; }
.einv-field-row { line-height: 1.8; font-size: 10.5px; }
.einv-field-key { color: #555; font-size: 10px; }
.invoice-seal-tax { display: none; }


/* ══════════════════════════════════════════════════════════════════
   社保参保证明高保真文档预览 (social-paper)
   ══════════════════════════════════════════════════════════════════ */
.social-paper {
  width: 100%;
  max-width: 820px;
  background: #ffffff;
  color: #111827;
  border-radius: 4px;
  padding: 40px 48px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  box-sizing: border-box;
  position: relative;
  font-size: 11.5px;
  line-height: 1.4;
}

.social-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #000000;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  font-family: "Microsoft YaHei", sans-serif;
}

.social-grid-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #000000;
  font-size: 11px;
  margin-top: 0;
}

.social-grid-table th, .social-grid-table td {
  border: 1px solid #000000;
  padding: 4px 4px;
  color: #000000;
}

.social-grid-table th {
  background: transparent;
  color: #000000;
  font-weight: 700;
  text-align: center;
}

.social-section-title {
  border: 1px solid #000000;
  border-bottom: none;
  padding: 4px 6px;
  font-weight: 700;
  font-size: 11.5px;
  text-align: center;
  margin-top: 0;
  background: transparent;
  color: #000000;
}

.social-seal-round {
  position: absolute;
  bottom: 25px;
  right: 50px;
  width: 136px;
  height: 136px;
  pointer-events: none;
  transform: rotate(-8deg);
  z-index: 10;
}

/* ══════════════════════════════════════════════════════════════════
   学历证书教学演示样本高保真文档预览 (edu-paper)
   ══════════════════════════════════════════════════════════════════ */
.edu-paper {
  width: 100%;
  max-width: 820px;
  background: #fdfbf7;
  color: #3e3832;
  border-radius: 4px;
  padding: 32px 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  font-family: "SimSun", "Songti SC", serif;
  box-sizing: border-box;
  position: relative;
  border: 3px solid #3e3832;
  outline: 1px solid #827a70;
  outline-offset: -10px;
}

/* ══════════════════════════════════════════════════════════════════
   右侧预览区域容器 (Preview Panel Layout)
   ══════════════════════════════════════════════════════════════════ */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-primary);
  position: relative;
}

.preview-toolbar {
  height: 52px;
  min-height: 52px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

.preview-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════════════════
   正式公文与协议 A4 独立框架模式排版 (Contract & Declaration Document Frame)
   ══════════════════════════════════════════════════════════════════ */
.doc-frame-viewport {
  flex: 1;
  height: calc(100% - 52px);
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 24px 20px 60px 20px;
  background: #0b1329;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.doc-frame-viewport::-webkit-scrollbar {
  width: 8px;
}
.doc-frame-viewport::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
.doc-frame-viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}
.doc-frame-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

.doc-page-sheet,
.a4-page-sheet {
  width: 794px;
  max-width: 100%;
  min-height: 1123px;
  background: #ffffff !important;
  color: #111827 !important;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  padding: 55px 65px 75px 65px;
  box-sizing: border-box;
  font-family: "SimSun", "Songti SC", "STSong", "Songti", serif;
  font-size: 14px;
  line-height: 1.85;
  position: relative;
  margin: 0 auto 32px auto;
  flex-shrink: 0;
}

.a4-page-footer {
  position: absolute;
  bottom: 22px;
  left: 65px;
  right: 65px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  font-size: 12px;
  color: #64748b;
  font-family: "SimSun", "Songti SC", "Times New Roman", serif;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
}

.a4-page-footer > span {
  white-space: nowrap;
  text-align: center;
}

.doc-sheet-header {
  text-align: center;
  margin-bottom: 24px;
}

.doc-sheet-title {
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #000000;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
}

.doc-party-block {
  margin-bottom: 18px;
}

.doc-party-row {
  font-size: 14.5px;
  line-height: 1.8;
  color: #1f2937;
  margin-bottom: 4px;
}

.doc-party-row strong {
  color: #111827;
  font-weight: 700;
}

.doc-clause-hd {
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  color: #000000;
  margin-top: 18px;
  margin-bottom: 6px;
}

.doc-p {
  text-indent: 0;
  margin-bottom: 8px;
  text-align: justify;
  color: #1f2937;
  line-height: 1.85;
}

.doc-p strong {
  color: #000000;
  font-weight: 700;
}

.doc-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 16px 0;
  font-size: 13.5px;
}

.doc-meta-table td, .doc-meta-table th {
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  vertical-align: middle;
}

.doc-meta-table th {
  background: #f9fafb;
  font-weight: 600;
  width: 20%;
  color: #374151;
}

.doc-signature-block {
  margin-top: 45px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  position: relative;
  page-break-inside: avoid;
}

.doc-party-sign-box {
  position: relative;
  border-top: 1px dashed #d1d5db;
  padding-top: 14px;
  font-size: 14px;
  line-height: 2.0;
  color: #111827;
  min-height: 120px;
}

.doc-stamp-overlay {
  position: absolute;
  left: 80px;
  top: -15px;
  width: 130px;
  height: 130px;
  pointer-events: auto !important;
  opacity: 0.88;
  transform: rotate(-6deg);
  z-index: 20;
  filter: drop-shadow(0 2px 5px rgba(220, 38, 38, 0.2));
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 50%;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.doc-stamp-overlay:hover {
  outline: 1.5px dashed #dc2626;
  outline-offset: 4px;
  opacity: 0.95;
  filter: drop-shadow(0 4px 10px rgba(220, 38, 38, 0.35));
}

.doc-stamp-overlay.is-dragging {
  cursor: grabbing !important;
  opacity: 1 !important;
  outline: 2px dashed #dc2626 !important;
  outline-offset: 4px;
  z-index: 50 !important;
  filter: drop-shadow(0 8px 20px rgba(220, 38, 38, 0.45)) !important;
}

.doc-sig-overlay {
  position: absolute;
  left: 80px;
  top: 15px;
  max-width: 140px;
  max-height: 60px;
  pointer-events: auto !important;
  z-index: 20;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 4px;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.doc-sig-overlay:hover {
  outline: 1.5px dashed #0284c7;
  outline-offset: 4px;
  opacity: 0.95;
  filter: drop-shadow(0 3px 8px rgba(2, 132, 199, 0.35));
}

.doc-sig-overlay.is-dragging {
  cursor: grabbing !important;
  opacity: 1 !important;
  outline: 2px dashed #0284c7 !important;
  outline-offset: 4px;
  z-index: 50 !important;
  filter: drop-shadow(0 6px 16px rgba(2, 132, 199, 0.45)) !important;
}

/* 电子手写签名板 Modal */
.sig-canvas-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sig-canvas-modal {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  width: 520px;
  max-width: 95vw;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.sig-pad-canvas {
  background: #ffffff;
  width: 100%;
  height: 220px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ══════════════════════════════════════════════════════════════════
   多用户与系统鉴权界面 (Login Overlay & User Management)
   ══════════════════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(12px);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 40px rgba(56, 189, 248, 0.12);
  backdrop-filter: blur(20px);
  animation: loginFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.4);
}

.login-brand h2 {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 6px;
  letter-spacing: 0.5px;
}

.login-subtitle {
  font-size: 12.5px;
  color: #94a3b8;
  margin: 0;
}

.login-form-group {
  margin-bottom: 18px;
}

.login-form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 14px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.login-input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
  background: rgba(15, 23, 42, 0.95);
}

.login-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 12px;
}

.login-remember {
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-remember input {
  accent-color: #0284c7;
  cursor: pointer;
}

.login-hint {
  color: #64748b;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-btn {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  transition: all 0.2s ease;
}

.login-btn:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}

/* 顶部用户身份徽章 */
.badge-role {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-role-admin {
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #facc15;
}

.badge-role-user {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

/* 用户管理表格 */
.user-mgmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.user-mgmt-table th {
  background: rgba(0, 0, 0, 0.25);
  color: #94a3b8;
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
}

.user-mgmt-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  vertical-align: middle;
}

.user-mgmt-table tr:hover td {
  background: rgba(56, 189, 248, 0.04);
}

.status-badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-badge-disabled {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

#modal-user-management {
  z-index: 10000;
}

#modal-user-edit {
  z-index: 10100;
}

/* ══════════════════════════════════════════════════════════════════
   顶部双排紧凑型操作栏 (Stacked Header Layout)
   ══════════════════════════════════════════════════════════════════ */
.header-actions-stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
}

.header-row-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.header-row-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.user-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  flex-wrap: nowrap;
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.2);
  flex-wrap: nowrap;
  white-space: nowrap;
  width: auto;
  flex-shrink: 0;
}

.ai-toolbar-group select,
.ai-toolbar-group button,
.user-toolbar-group button {
  width: auto !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

#ai-model-select {
  width: auto !important;
  max-width: 125px !important;
  min-width: 80px;
}

#ai-lang-select {
  width: auto !important;
  max-width: 145px !important;
  min-width: 100px;
}

/* ══════════════════════════════════════════════════════════════════
   用户中心内部多 Tab 导航 (User Center Tabs)
   ══════════════════════════════════════════════════════════════════ */
.user-center-nav-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.user-center-tab-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.user-center-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.user-center-tab-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.user-mgmt-tab-pane {
  display: none;
}

.user-mgmt-tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

/* 材料审计日志分类徽章 */
.log-cat-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.log-cat-invoice { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.log-cat-social { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.35); }
.log-cat-contract { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.log-cat-declaration { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.35); }
.log-cat-bank { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.35); }
.log-cat-education { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.35); }
.log-cat-idcard, .log-cat-passport, .log-cat-business { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.log-cat-auth { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }

