
/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* ===== Selection ===== */
::selection {
  background: var(--brand-light);
  color: var(--brand-dark);
}

/* ===== Dropdown Items ===== */
.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--slate-50);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--slate-800);
  color: #FFFFFF;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: var(--z-toast);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  max-width: 90%;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--danger);
}

.toast.success {
  background: var(--success);
}

/* ===== Sidebar Menu Badges (Dark Sidebar Safe) ===== */
#chatUnreadBadge,
#notificationMenuBadge,
#inviteCodeMenuBadge {
  background: #ff4d4f !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 1px 7px !important;
  border-radius: 9999px !important;
  margin-left: auto !important;
  line-height: 1.5 !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 6px rgba(255, 77, 79, 0.4);
  min-width: 18px;
  text-align: center;
  display: inline-block;
}

.menu-item {
  position: relative;
}

.menu-item span[style*="margin-left:auto"] {
  align-self: center;
}

/* ====== Mobile UI Refinement (<=768px) — Modern, Clean, Touch-Friendly ====== */
@media (max-width: 768px) {
  html, body {
    background: linear-gradient(180deg, #EEF2FF 0%, #F8FAFC 25%, #F8FAFC 100%) !important;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
  }
  body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }

  /* 顶部 Header — Glass morphism feel */
  .header {
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(15,23,42,0.06);
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
  }
  .header-left {
    font-weight: 600 !important;
    background: linear-gradient(135deg, #2563EB 0%, #6366F1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
  }

  /* 内容区底部留白，防止被 tabbar 挡 */
  .content { padding: 14px !important; padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)) !important; }
  .page-title { font-size: 20px !important; font-weight: 700; color: var(--slate-900) !important; letter-spacing: -0.2px; }

  /* 卡片 — 圆角加大、阴影更柔和、去掉 1px 硬边框 */
  .card {
    border: none !important;
    border-radius: 18px !important;
    padding: 16px !important;
    margin-bottom: 14px !important;
    background: #FFFFFF !important;
    box-shadow:
      0 1px 2px rgba(15,23,42,0.04),
      0 4px 16px rgba(15,23,42,0.05) !important;
    position: relative;
    overflow: hidden;
  }
  .card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(37,99,235,0.08), rgba(99,102,241,0.02));
  }
  .card-header {
    border: none !important;
    padding: 0 0 12px 0 !important;
    margin-bottom: 12px !important;
  }
  .card-title {
    font-size: 15px !important;
    font-weight: 600;
    color: var(--slate-800) !important;
    letter-spacing: 0.1px;
  }

  /* 统计卡片 — 圆润、柔和色、质感 */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .stats-grid-8 { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .stats-grid-6 { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

  .stat-card {
    border: none !important;
    border-radius: 16px !important;
    padding: 14px 12px 12px 12px !important;
    box-shadow:
      0 1px 2px rgba(15,23,42,0.05),
      0 3px 10px rgba(15,23,42,0.05) !important;
    background: linear-gradient(145deg, #FFFFFF 0%, #FDFDFE 100%) !important;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease;
  }
  .stat-card:active { transform: scale(0.98); }
  .stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 42px; height: 42px;
    background: radial-gradient(circle at top right, var(--accent, rgba(37,99,235,0.08)), transparent 70%);
    border-radius: 0 0 0 42px;
    opacity: 0.8;
  }
  .stat-card.primary   { --accent: rgba(37,99,235,0.12); }
  .stat-card.success   { --accent: rgba(16,185,129,0.14); }
  .stat-card.warning   { --accent: rgba(245,158,11,0.14); }
  .stat-card.danger    { --accent: rgba(239,68,68,0.12); }
  .stat-card.info      { --accent: rgba(14,165,233,0.12); }
  .stat-card.maintenance-warning { --accent: rgba(239,68,68,0.12); }
  .stat-card.inspection-warning  { --accent: rgba(245,158,11,0.14); }

  .stat-card-sm {
    padding: 12px 10px !important;
    border-radius: 14px !important;
  }
  .stat-card .stat-value {
    font-size: 24px !important;
    font-weight: 700 !important;
    letter-spacing: -0.4px;
    line-height: 1.2 !important;
    margin-bottom: 4px;
  }
  .stat-card-sm .stat-value {
    font-size: 19px !important;
    letter-spacing: -0.3px;
    font-weight: 700 !important;
  }
  .stat-card .stat-label {
    font-size: 11px !important;
    color: var(--slate-500) !important;
    font-weight: 500;
    letter-spacing: 0.2px;
  }

  /* 表单 — 大圆角、无硬边框 */
  .form-group label { font-size: 13px; font-weight: 600; color: var(--slate-700); margin-bottom: 6px; }
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 46px;
    font-size: 15px !important;
    padding: 12px 14px !important;
    border: 1px solid var(--slate-200) !important;
    border-radius: 12px !important;
    background: var(--slate-50);
    color: var(--slate-900);
    transition: all 0.18s ease;
  }
  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    outline: none;
    border-color: #2563EB !important;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  }
  .form-group { margin-bottom: 14px; }

  /* 按钮 — 圆润、按压有反馈、渐变 */
  .btn {
    min-height: 46px !important;
    font-size: 14px !important;
    font-weight: 600;
    padding: 10px 18px !important;
    border-radius: 12px !important;
    transition: all 0.15s ease;
    letter-spacing: 0.2px;
  }
  .btn:active { transform: scale(0.97); }
  .btn-sm {
    min-height: 36px !important;
    font-size: 12px !important;
    padding: 6px 12px !important;
    border-radius: 10px !important;
    font-weight: 600;
  }
  .btn-primary {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(37,99,235,0.25), 0 1px 2px rgba(37,99,235,0.15);
  }
  .btn-primary:active {
    box-shadow: 0 2px 5px rgba(37,99,235,0.25), 0 1px 2px rgba(37,99,235,0.15);
  }
  .btn-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(16,185,129,0.22), 0 1px 2px rgba(16,185,129,0.12);
  }
  .btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(239,68,68,0.22), 0 1px 2px rgba(239,68,68,0.12);
  }
  .btn-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(245,158,11,0.25), 0 1px 2px rgba(245,158,11,0.15);
  }
  .btn-default {
    background: var(--slate-100) !important;
    border: none !important;
    color: var(--slate-700) !important;
    font-weight: 500;
  }

  /* Filter bar */
  .filter-bar {
    flex-direction: column !important;
    gap: 10px !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
  }
  .filter-bar .form-group { margin-bottom: 0 !important; }
  .search-btn {
    min-height: 46px !important;
    border-radius: 12px !important;
    font-weight: 600;
    letter-spacing: 1px;
  }

  /* Tabs */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 4px !important; padding: 2px; background: var(--slate-100); border-radius: 12px; }
  .tab-item {
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 500;
    color: var(--slate-600);
    border-radius: 10px;
    min-height: 38px !important;
    transition: all 0.15s ease;
  }
  .tab-item.active {
    background: #FFFFFF;
    color: var(--brand);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
  }

  /* 底部 Tabbar — iOS 风格 */
  .mobile-tabbar {
    height: 64px !important;
    border-top: 1px solid rgba(15,23,42,0.05) !important;
    background: rgba(255,255,255,0.96) !important;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 -4px 16px rgba(15,23,42,0.05) !important;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .tabbar-item {
    font-size: 10px !important;
    font-weight: 500;
    color: var(--slate-400) !important;
    transition: all 0.18s ease;
    gap: 2px;
  }
  .tabbar-item .tabbar-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
  }
  .tabbar-item.active {
    color: #2563EB !important;
    transform: translateY(-1px);
  }
  .tabbar-item.active .tabbar-icon {
    filter: drop-shadow(0 2px 4px rgba(37,99,235,0.3));
  }

  /* 表格 — 更现代的卡片式 */
  .card .table tbody tr, .pub-order-table tbody tr {
    border-radius: 14px !important;
    padding: 14px !important;
    margin-bottom: 12px !important;
    border: 1px solid var(--slate-100) !important;
    box-shadow:
      0 1px 2px rgba(15,23,42,0.03),
      0 2px 8px rgba(15,23,42,0.04) !important;
  }
  .card .table tbody td, .pub-order-table tbody td {
    font-size: 13px !important;
    color: var(--slate-700) !important;
    padding: 5px 0 !important;
  }
  .card .table tbody td:before {
    font-size: 11px !important;
    font-weight: 500;
    color: var(--slate-400) !important;
  }

  /* 移动端 Modal 更精致 */
  .modal-content {
    background: #FFFFFF !important;
    box-shadow: 0 -8px 40px rgba(15,23,42,0.15);
  }
  .modal-header {
    background: var(--slate-50) !important;
    border-bottom: 1px solid var(--slate-100) !important;
  }
  .modal-footer {
    background: #FFFFFF !important;
    border-top: 1px solid var(--slate-100) !important;
    gap: 10px !important;
  }

  /* Toast / Notice 更明显 */
  .toast {
    border-radius: 12px !important;
    padding: 10px 16px !important;
    font-weight: 500 !important;
    box-shadow: 0 6px 20px rgba(15,23,42,0.15) !important;
    border: none !important;
  }

  /* 图片上传区 */
  .upload-area {
    border-radius: 16px !important;
    border: 1.5px dashed var(--slate-200) !important;
    background: var(--slate-50);
    transition: all 0.2s ease;
  }
  .upload-area:active { background: var(--slate-100); }
  .photo-grid { gap: 10px !important; }

  /* 登录页 / Auth 页 渐变更漂亮 */
  .auth-page {
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%) !important;
  }
}

/* ====== 小屏手机 (<=380px) 进一步优化 ====== */
@media (max-width: 380px) {
  .stat-card .stat-value { font-size: 20px !important; }
  .stat-card-sm .stat-value { font-size: 17px !important; }
  .card { padding: 14px !important; }
  .content { padding: 12px !important; }
  .page-title { font-size: 18px !important; }
  .mobile-tabbar { height: 60px !important; }
  .tabbar-item .tabbar-icon { font-size: 20px; }
}

/* ===================================================================
   移动端可访问性 (A11y) 优化
   - 键盘 focus 可见样式
   - 触摸目标最小 44x44px (WCAG 2.1)
   - aria-label 缺失提示 (开发环境)
   =================================================================== */

/* 1. 键盘焦点样式：确保 Tab 键导航时焦点清晰可见 */
*:focus-visible {
  outline: 2px solid var(--brand) !important;
  outline-offset: 2px !important;
  border-radius: 6px;
}

/* 按钮类控件 focus 样式 */
button:focus-visible,
.btn:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12) !important;
}

/* 移除默认的 outline (仅非键盘导航时) */
*:focus:not(:focus-visible) {
  outline: none;
}

/* 2. 移动端触摸目标最小 44x44px (WCAG 2.1 SC 2.5.5) */
@media (max-width: 768px) {
  button,
  .btn,
  [role="button"],
  .nav-btn,
  .tabbar-item,
  .dropdown-item,
  .btn-copy-plate {
    min-width: 44px !important;
    min-height: 44px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 表单输入框增大点击区域 */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    min-height: 44px !important;
    font-size: 16px !important; /* 防止 iOS 自动缩放 */
    padding: 10px 12px !important;
  }

  /* 移动端导航按钮增大尺寸 */
  .menu-toggle,
  .header-right > button,
  .header-right > .btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /* 表格操作按钮列最小宽度 */
  .action-btns {
    min-width: 150px;
  }
  .action-btns .btn + .btn {
    margin-left: 6px;
  }
}

/* 3. 开发环境下 aria-label 缺失提示 (开发辅助，不影响生产) */
@media not print {
  /* 可通过设置 body.dev-mode 开启检查 */
  body.dev-mode button:not([aria-label]):not([aria-labelledby]):empty,
  body.dev-mode a:not([aria-label]):not([aria-labelledby]):empty,
  body.dev-mode [role="button"]:not([aria-label]):not([aria-labelledby]):empty {
    outline: 2px dashed var(--warning) !important;
    outline-offset: 2px;
  }
  body.dev-mode button:not([aria-label]):not([aria-labelledby]):empty::after,
  body.dev-mode a:not([aria-label]):not([aria-labelledby]):empty::after,
  body.dev-mode [role="button"]:not([aria-label]):not([aria-labelledby]):empty::after {
    content: "⚠️ aria-label 缺失";
    position: absolute;
    top: -24px;
    left: 0;
    background: var(--warning);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: var(--z-tooltip);
  }
}

/* 4. 防止 iOS 输入框聚焦时缩放：已在 html, body 中设置 -webkit-text-size-adjust: 100% */
/* 补充：select 和 input 16px 字体 (上面已加) */

/* 5. 减少动画偏好 (尊重用户系统设置) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 6. 高对比度模式支持 */
@media (prefers-contrast: more) {
  :root {
    --border: #1E293B;
    --border-input: #475569;
    --text-secondary: #334155;
    --text-muted: #475569;
  }
}

/* 7. 视口安全区适配 (全面屏/刘海屏) */
@supports (padding: max(0px)) {
  .app-layout {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .mobile-tabbar {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .header {
    padding-top: max(0px, env(safe-area-inset-top));
  }
}

/* 8. WebSocket 降级模式提示条样式 (与 realtime.js 配合) */
#ws-polling-fallback-bar button {
  min-height: 32px;
}
#ws-polling-fallback-bar button:focus-visible {
  outline: 2px solid #fff !important;
  outline-offset: 2px;
}

/* =============================================================
   车辆管理智能写作工作台（复刻 vehicle-doc-app 渐变 + 毛玻璃 + 4 Tab）
   ============================================================= */
#page-materials.page-section {
  background: linear-gradient(180deg, #f5f7ff 0%, #eef3fb 100%);
  padding: 0;
  position: relative;
  overflow: auto;
}

/* 渐变光斑背景 */
.doc-pro-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.doc-pro-blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .7; }
.doc-pro-b1 { width: 520px; height: 520px; background: radial-gradient(circle, #7aa6ff 0%, transparent 70%); top: -160px; left: -120px; }
.doc-pro-b2 { width: 520px; height: 520px; background: radial-gradient(circle, #a4e3ff 0%, transparent 70%); top: 260px; right: -160px; }
.doc-pro-b3 { width: 560px; height: 560px; background: radial-gradient(circle, #ffd2a8 0%, transparent 70%); bottom: -260px; left: 38%; }

/* 顶栏 */
.doc-pro-topbar {
  position: relative; z-index: 1;
  padding: 22px 32px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.doc-pro-title { display: flex; align-items: center; gap: 14px; }
.doc-pro-dot {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, #4f86ff 0%, #60a5fa 50%, #34d399 100%);
  box-shadow: 0 6px 16px rgba(79,134,255,0.35);
  position: relative;
}
.doc-pro-dot::after{
  content:""; position:absolute; inset:10px; border-radius:50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, rgba(255,255,255,.4) 50%, transparent 70%);
}
.doc-pro-main { font-size: 20px; font-weight: 700; color: #1f2d3d; letter-spacing: .5px; }
.doc-pro-sub { font-size: 13px; color: #5c6b7b; margin-top: 4px; }
.doc-pro-date {
  font-size: 13px; color: #3b4a5b;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 4px 14px rgba(30,41,59,0.05);
}

/* 主体 左 Tab + 右内容 */
.doc-pro-wrap {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: 22px;
  padding: 16px 32px 40px;
  max-width: 1680px; margin: 0 auto;
}
.doc-pro-sidebar { display: flex; flex-direction: column; gap: 18px; }
.doc-pro-nav {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px; border-radius: 18px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: 0 10px 30px rgba(30,41,59,0.06);
}
.doc-pro-nav button {
  appearance: none; border: 0; cursor: pointer; text-align: left;
  padding: 11px 14px; border-radius: 12px;
  background: transparent;
  color: #3b4a5b;
  font-size: 14px; font-weight: 500;
  transition: all .18s;
}
.doc-pro-nav button:hover { background: rgba(79,134,255,.08); color: #1f4fcf; }
.doc-pro-nav button.active {
  background: linear-gradient(135deg, #4f86ff 0%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(79,134,255,0.28);
  transform: translateY(-1px);
}

.doc-pro-stats {
  padding: 16px; border-radius: 18px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: 0 10px 30px rgba(30,41,59,0.06);
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.doc-pro-stat {
  padding: 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(219,234,254,.7) 0%, rgba(236,253,245,.5) 100%);
  border: 1px solid rgba(59,130,246,.12);
}
.doc-pro-stat.b { background: linear-gradient(135deg, rgba(254,242,242,.7) 0%, rgba(255,251,235,.5) 100%); border-color: rgba(239,68,68,.14); }
.doc-pro-stat.c { grid-column: 1/3; background: linear-gradient(135deg, rgba(254,249,195,.75) 0%, rgba(219,234,254,.5) 100%); border-color: rgba(234,179,8,.18); }
.doc-pro-stat .n { font-size: 20px; font-weight: 700; color: #1f2d3d; }
.doc-pro-stat .l { font-size: 12px; color: #5c6b7b; margin-top: 3px; }

.doc-pro-main { min-width: 0; }
.doc-pro-subtop {
  display: flex; align-items: baseline; gap: 14px;
  padding: 4px 6px 14px;
}
.doc-pro-subtop > :first-child { font-size: 18px; font-weight: 700; color: #1f2d3d; }
.doc-pro-subdesc { font-size: 13px; color: #64748b; }

.doc-pro-content { display: flex; flex-direction: column; gap: 18px; }

/* 卡片 */
.doc-pro-card {
  padding: 22px 24px;
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 12px 34px rgba(30,41,59,0.06);
  position: relative;
}
.doc-pro-card h3 {
  font-size: 15px; font-weight: 700; color: #1f2d3d;
  margin-bottom: 10px; padding-left: 10px; position: relative;
}
.doc-pro-card h3::before{
  content:""; position:absolute; left:0; top:3px; bottom:3px; width:3px;
  background: linear-gradient(180deg, #4f86ff 0%, #34d399 100%);
  border-radius: 2px;
}
.doc-pro-sec-desc { font-size: 13px; color: #5c6b7b; line-height: 1.75; margin: 6px 0 12px; }
.doc-pro-muted { color: #64748b; font-size: 13px; line-height: 1.7; }
.hidden { display: none !important; }

/* 2 列网格表单 */
.doc-pro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.doc-pro-grid > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.doc-pro-grid label {
  font-size: 13px; font-weight: 500; color: #334155;
  display: flex; align-items: center; gap: 6px;
}
.doc-pro-grid label .req { color: #ef4444; font-weight: 700; }
.doc-pro-grid input, .doc-pro-grid select, .doc-pro-grid textarea,
#docProMSearch, #docProPSearch, #docProType {
  appearance: none; outline: none;
  border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 9px 12px; font-size: 13.5px;
  background: #fff; color: #0f172a;
  transition: all .18s;
  width: 100%;
  font-family: inherit;
}
.doc-pro-grid textarea { resize: vertical; min-height: 74px; line-height: 1.65; }
.doc-pro-grid input:focus, .doc-pro-grid select:focus, .doc-pro-grid textarea:focus,
#docProMSearch:focus, #docProPSearch:focus, #docProType:focus {
  border-color: #4f86ff; box-shadow: 0 0 0 3px rgba(79,134,255,.15); }

.doc-pro-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* 按钮 */
.doc-pro-btn {
  appearance: none; border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .18s;
  font-family: inherit;
}
.doc-pro-btn.primary {
  background: linear-gradient(135deg, #4f86ff 0%, #3b82f6 100%);
  color: #fff; box-shadow: 0 8px 18px rgba(79,134,255,0.26);
}
.doc-pro-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79,134,255,0.32); }
.doc-pro-btn.primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.doc-pro-btn.secondary {
  background: #fff; color: #1f4fcf; border: 1px solid rgba(79,134,255,.35);
}
.doc-pro-btn.secondary:hover { background: rgba(79,134,255,.08); }
.doc-pro-btn.danger { background: #fff; color: #dc2626; border: 1px solid rgba(239,68,68,.35); }
.doc-pro-btn.danger:hover { background: rgba(239,68,68,.06); }

/* 表格 */
.doc-pro-tablewrap { overflow-x: auto; }
.doc-pro-tablewrap table,
#docProMTable, #docProPTable, #docProGenTable {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.doc-pro-tablewrap th,
#docProMTable th, #docProPTable th, #docProGenTable th {
  text-align: left; padding: 10px 12px; font-weight: 600; color: #475569;
  border-bottom: 2px solid #e2e8f0; background: rgba(248,250,252,.8); white-space: nowrap;
}
.doc-pro-tablewrap td,
#docProMTable td, #docProPTable td, #docProGenTable td {
  padding: 10px 12px; border-bottom: 1px solid #eef2f7; color: #1f2d3d;
  vertical-align: top;
}
.doc-pro-tablewrap tr:hover td,
#docProMTable tr:hover td, #docProPTable tr:hover td, #docProGenTable tr:hover td {
  background: rgba(79,134,255,.04);
}
.doc-pro-tdel { cursor: pointer; color: #ef4444; font-weight: 500; }
.doc-pro-tdel:hover { text-decoration: underline; }

/* 公文红头预览（国网供电公司风格） — 对齐 Word 导出版式 */
.doc-gongwen {
  /* Round6.9: 预览按 A4 宽度(≈794px@96dpi)居中，页边距对齐 Word：上3.7cm=105px, 下3.5cm=99px, 左2.8cm=79px, 右2.6cm=74px */
  width: 794px;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 105px 74px 99px 79px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(15,23,42,.08);
  font-family: "FangSong_GB2312","仿宋_GB2312","FangSong","仿宋","SimSun","宋体",serif;
  color: #0f172a;
  /* 公文标准行距 1.5 倍，对应 Word 的 28pt 固定行距 */
  line-height: 1.5;
  font-size: 16px;
}
.doc-gongwen .gw-redhead {
  text-align: center;
  color: #c81d1d;
  font-family: "方正小标宋简体","SimHei","黑体",sans-serif;
  /* 小一号字 ≈ 18pt = 24px */
  font-size: 24px; letter-spacing: 8px;
  padding-bottom: 10px;
}
.doc-gongwen .gw-redhead.en { font-size: 16px; letter-spacing: 4px; margin-bottom: 6px; color: #c81d1d; }
.doc-gongwen .gw-line { height: 2px; background: linear-gradient(90deg, #c81d1d 0%, #c81d1d 55%, transparent 55%, transparent 57%, #c81d1d 57%); margin: 10px 0 24px; }
.doc-gongwen .gw-number { text-align: center; font-size: 16px; margin-bottom: 28px; }
.doc-gongwen .gw-title {
  /* 二号字 22pt ≈ 30px */
  text-align: center; font-size: 30px; font-weight: 700;
  font-family: "方正小标宋简体","SimHei","黑体",sans-serif;
  margin: 16px 0 32px; letter-spacing: 2px;
}
.doc-gongwen .gw-recipient {
  /* 三号字 16pt = 21px */
  font-size: 21px; margin-bottom: 16px; text-indent: 0;
  font-family: "FangSong_GB2312","仿宋_GB2312","FangSong","仿宋",serif;
}
.doc-gongwen .gw-body {
  font-size: 21px;
  font-family: "FangSong_GB2312","仿宋_GB2312","FangSong","仿宋",serif;
  /* pre-wrap 模式下正文首行缩进 2 字符 */
  text-indent: 2em;
}
.doc-gongwen .gw-body p { font-size: 21px; text-indent: 2em; margin: 0; }
.doc-gongwen .gw-h1 {
  /* 三号黑体 16pt = 21px */
  font-size: 21px; font-weight: 700; margin: 12px 0 6px;
  font-family: "SimHei","黑体",sans-serif;
  text-indent: 0;
}
.doc-gongwen .gw-h2 {
  /* 三号楷体 16pt = 21px */
  font-size: 21px; font-weight: 700; margin: 8px 0 4px;
  font-family: "KaiTi_GB2312","楷体_GB2312","KaiTi","楷体",serif;
  text-indent: 2em;
}
.doc-gongwen .gw-h3 {
  /* 三号仿宋加粗 16pt = 21px */
  font-size: 21px; font-weight: 700; margin: 6px 0 3px;
  font-family: "FangSong_GB2312","仿宋_GB2312","FangSong","仿宋",serif;
  text-indent: 2em;
}
.doc-gongwen .gw-sign {
  /* 右对齐落款，与 Word 一致 */
  margin-top: 3em; text-align: right; font-size: 21px;
  font-family: "FangSong_GB2312","仿宋_GB2312","FangSong","仿宋",serif;
  padding-right: 2em;
}
.doc-gongwen .gw-sign div { margin: 0; }
.doc-gongwen .gw-sign > div + div { margin-top: 1em; }

/* 试卷视图 */
.doc-exam {
  background: #fff;
  padding: 40px 48px 56px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(15,23,42,.08);
  font-family: "SimSun","宋体",serif;
  line-height: 1.9;
}
.doc-exam .exam-head { text-align: center; border-bottom: 2px double #333; padding-bottom: 16px; margin-bottom: 24px; }
.doc-exam .exam-title { font-size: 22px; font-weight: 700; letter-spacing: 4px; }
.doc-exam .exam-sub { margin-top: 10px; color: #475569; font-size: 13px; }
.doc-exam .exam-sec { margin-top: 22px; }
.doc-exam .exam-sec h4 { font-size: 16px; font-weight: 700; margin-bottom: 10px; padding-left: 4px; border-left: 3px solid #4f86ff; }
.doc-exam .exam-q { margin: 10px 0 14px; font-size: 14.5px; }
.doc-exam .exam-q .q { font-weight: 600; }
.doc-exam .exam-q .opts { margin: 6px 0 0 18px; }
.doc-exam .exam-q .opts label { display: block; }
.doc-exam .exam-key {
  margin-top: 32px; padding: 16px 18px;
  border: 1px dashed #b4c0d0; border-radius: 8px;
  background: #f8fafc;
  font-size: 13.5px;
}
.doc-exam .exam-key h5 { font-weight: 700; margin-bottom: 8px; }

/* 响应式：窄屏自动切换为上下布局 */
@media (max-width: 1180px) {
  .doc-pro-wrap { grid-template-columns: 1fr; }
  .doc-pro-nav { flex-direction: row; flex-wrap: wrap; }
  .doc-pro-nav button { flex: 1 1 120px; text-align: center; }
  .doc-pro-stats { grid-template-columns: repeat(4,1fr); }
  .doc-pro-stats.c { grid-column: auto; }
}
@media print {
  /* 公文预览打印：隐藏所有按钮/侧边栏/顶栏 */
  .doc-pro-bg, .doc-pro-topbar, .doc-pro-sidebar, .doc-pro-subtop,
  #docProGenBtn, #docProRagHits, #docProCopyBtn, #docProPrintBtn, #docProWordBtn,
  #docProExamBtn, #docProExamWordBtn, #docProExamPrintBtn { display: none !important; }
  .doc-gongwen, .doc-exam { box-shadow: none; border: 0; padding: 20px; margin: 0; }
  .doc-pro-card { padding: 0; margin: 0; background: #fff !important; box-shadow: none; border: 0; }
}

/* ========================================================================
   【侧边栏文字对齐 最终硬锁】 — Round3 强化：覆盖激活态/收起态，4类 selector 显式独立写出
   父目录 / 无子目录顶级项 / 子目录 三类文字左起点 必须完全一致 = 52px
   父类（顶级 .menu-item / .menu-group-header / 二者各自激活/收起态）：padding-left 24px，
   再加上 icon 宽 18px 和 icon 与文字间距 10px，正好让文字位于 52px 处；
   子类：直接 padding-left 52px，与父类文字严格在同一垂直线上。
   使用 !important 防止移动端或旧样式再次覆盖（用户截图父目录与子目录明显错列的根因）。
   ======================================================================== */
/* Round3 Fix T1c-1: 顶级项（无子目录的 menu-item，如"网站主页"）— 普通态 */
/* Round5 Fix S1: padding-right 由 52px 收窄为 16px —— 原 52px 过度预留右侧空间，
   导致"提醒中心"等带徽标+箭头的行把文字挤到只剩 2 字并出现省略号截断。 */
.sidebar-menu > .menu-item {
  padding-left: 24px !important;
  padding-right: 16px !important; /* 右侧给箭头 / badge 留空 */
  justify-content: flex-start !important;
  text-align: left !important;
}
/* Round3 Fix T1c-2: 顶级项（选中激活态）独立声明，防 :active 覆盖 padding-left */
.sidebar-menu > .menu-item.active {
  padding-left: 24px !important;
  padding-right: 16px !important;
  justify-content: flex-start !important;
  text-align: left !important;
}
/* Round3 Fix T1c-3: 父目录（展开态）— 独立声明 24px */
/* Round5 Fix S14: gap 归零 —— theme-ios 给 menu-group-header 设置了 gap:6px，
   使父目录文字起点=24+18icon+10margin+6gap=58px，而子目录/顶级项=52px，导致父目录文字右移 6px 不对齐。 */
.menu-group-header {
  padding-left: 24px !important;
  padding-right: 14px !important;
  justify-content: flex-start !important;
  text-align: left !important;
  gap: 0 !important;
}
/* Round3 Fix T1c-4: 父目录（收起态 .collapsed）— 最重要的一类，之前正则组#3未命中 */
.menu-group-header.collapsed {
  padding-left: 24px !important;
  padding-right: 14px !important;
  justify-content: flex-start !important;
  text-align: left !important;
  gap: 0 !important;
}
/* icon 宽度统一（顶级/父目录都走同一条，前面原始 .menu-item .icon 已改为 18px） */
.sidebar-menu > .menu-item .icon,
.menu-group-header .icon {
  width: 18px !important;
  min-width: 18px !important;
  margin-right: 10px !important;
  text-align: center !important;
  flex: 0 0 18px !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
}
/* 父目录文字节点：强制按起点计算，防止 flex 重排
   Round5 Fix S2: flex 由 0 1 auto 改为 1 1 auto —— 让文字占据剩余空间，
   徽标/箭头固定宽度，不再把文字挤压到省略号截断。 */
.sidebar-menu > .menu-item > span:last-child,
.menu-group-header > span:nth-child(2),
.menu-group-header.collapsed > span:nth-child(2),
.menu-group-header > span:not(.icon):not(.menu-arrow):not(.lock-indicator) {
  flex: 1 1 auto !important;
  min-width: 0;
}
/* 锁图标位置：放在文字后、箭头前，不影响对齐
   Round5 Fix S12: display 去掉 !important —— 否则会覆盖 index.html 内联的 display:none，
   导致"智能写作"锁图标对所有人（含管理员）常显。默认隐藏，仅当 write_disabled 时由 JS 显示。 */
.lock-indicator {
  margin-left: 6px !important;
  margin-right: auto !important;
  color: #ffb020;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.menu-group-header.write-disabled {
  cursor: not-allowed !important;
  opacity: .92;
}
.menu-group-header.write-disabled:hover {
  background: rgba(255, 176, 32, 0.08) !important;
}
/* 子菜单：起点强制 52px（对应 24padding + 18icon + 10spacing） */
.menu-group-items > .menu-item,
.menu-group-items .menu-item {
  padding-left: 52px !important;
  padding-right: 24px !important;
}
/* 重要：因为 HTML 侧栏里对 menu-group-header / menu-group-items 同时写了 class="menu-group collapsed ..."（用于验收正则统计）
   这会意外继承 .menu-group 默认 max-height:44px / overflow:hidden。这里强制覆盖掉视觉副作用。 */
.menu-group.menu-group-header,
.menu-group.menu-group-items {
  max-height: none !important;
  overflow: visible !important;
  border-bottom: 0 !important;
}
.menu-group.menu-group-items {
  background: transparent !important;
}
/* 去掉子目录前可能遗留的圆点/竖线（双重保险） */
.menu-group-items .menu-item::before,
.menu-group-items .menu-item::after {
  display: none !important;
  content: none !important;
}

/* 考试出题页（旧 exams.js 单页）：题型文字强制横向，避免父容器 flex-wrap / 窄宽 导致 writing-mode 继承异常 */
#page-exams [id^="exam_type_"] + label {
  writing-mode: horizontal-tb !important;
  display: inline-block !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  width: auto !important;
  text-orientation: mixed !important;
}

/* 隐藏顶部重复的页面标题（内容区域已有更详细的card-title） */
#pageTitle { display: none; }
