/* ============================================================
   Hz System — UI Design System (v2.0)
   基于 UI设计规范 对齐
   ============================================================ */

/* ===== Step 1: Design Tokens (CSS Variables) ===== */
:root {
  /* 主色调 */
  --primary: #030213;
  --primary-foreground: #ffffff;

  /* 品牌蓝 */
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;

  /* 语义色 */
  --background: #f9fafb;
  --card: #ffffff;
  --foreground: #171717;
  --border: rgba(0, 0, 0, 0.1);
  --secondary: #ededf3;
  --secondary-foreground: #374151;
  --muted: #ececf0;
  --muted-foreground: #717182;
  --accent: #e9ebef;
  --destructive: #d4183d;
  --destructive-foreground: #ffffff;
  --input-background: #f3f3f5;

  /* 功能色 */
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;
  --purple-600: #9333ea;
  --purple-100: #f3e8ff;
  --purple-50: #faf5ff;

  /* 灰色系 */
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;

  /* 字体大小 */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  /* 过渡 */
  --transition-colors: color 0.2s, background-color 0.2s, border-color 0.2s;
  --transition-transform: transform 0.2s;
  --transition-opacity: opacity 0.2s;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* ===== Step 2: Global Reset + Body + Typography ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: var(--text-2xl); font-weight: 500; line-height: 1.5; color: var(--foreground); }
h2 { font-size: var(--text-xl); font-weight: 500; line-height: 1.5; color: var(--foreground); }
h3 { font-size: var(--text-lg); font-weight: 500; line-height: 1.5; color: var(--foreground); }
h4 { font-size: var(--text-base); font-weight: 500; line-height: 1.5; color: var(--foreground); }
label { font-size: var(--text-base); font-weight: 500; line-height: 1.5; }

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Step 3: Button System ===== */

/* Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
  text-decoration: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Sizes */
.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: var(--text-sm);
  gap: 6px;
}
.btn {
  height: 36px;
  padding: 0 16px;
}
.btn-lg {
  height: 40px;
  padding: 0 24px;
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

/* Variant: Default (深底白字) */
.btn-default {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-default:hover { background: rgba(3, 2, 19, 0.9); }

/* Variant: Primary (品牌蓝) */
.btn-primary {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}
.btn-primary:hover { background: var(--blue-700); }

/* Variant: Outline (白底带边框) */
.btn-outline {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--accent);
}

/* Variant: Secondary (浅灰紫底) */
.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--secondary);
}
.btn-secondary:hover { background: rgba(237, 237, 243, 0.8); }

/* Variant: Destructive (红色危险) */
.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}
.btn-destructive:hover { background: rgba(212, 24, 61, 0.9); }

/* Variant: Ghost (透明) */
.btn-ghost {
  background: transparent;
  color: var(--foreground);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--accent); }

/* Variant: Link (下划线) */
.btn-link {
  background: transparent;
  color: var(--blue-600);
  border: none;
  text-decoration: underline;
  padding: 0;
  height: auto;
}
.btn-link:hover { color: var(--blue-700); }

/* ===== Legacy Button Aliases (向后兼容) ===== */
.save-btn,
.req-new-btn,
.hz-save-btn,
.admin-btn,
.docs-btn,
#submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
  background: var(--blue-600);
  color: white;
}
.save-btn:hover, .req-new-btn:hover, .hz-save-btn:hover,
.admin-btn:hover, .docs-btn:hover, #submit-btn:hover {
  background: var(--blue-700);
}
.save-btn:focus-visible, .req-new-btn:focus-visible, .hz-save-btn:focus-visible,
.admin-btn:focus-visible, .docs-btn:focus-visible, #submit-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--blue-600);
  background: var(--card);
  color: var(--blue-600);
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
  margin-right: 10px;
}
.add-btn:hover { background: var(--blue-100); }
.add-btn:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); }

.export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--green-600);
  background: var(--card);
  color: var(--green-600);
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}
.export-btn:hover { background: var(--green-100); }

.delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 15px;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--destructive);
  color: white;
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
  align-self: flex-start;
}
.delete-btn:hover { background: rgba(212, 24, 61, 0.9); }

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--gray-600);
  color: white;
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}
.back-btn:hover { background: var(--gray-700); }

/* ===== Input System ===== */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 4px 12px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-background);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--foreground);
  font-family: inherit;
  line-height: 1.4;
  outline: none;
  transition: var(--transition-colors);
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
input::placeholder, textarea::placeholder {
  color: var(--muted-foreground);
}
textarea {
  min-height: 80px;
  resize: vertical;
  padding: 8px 12px;
  height: auto;
}

/* ===== Card System ===== */
.config-section {
  background: var(--card);
  padding: 16px 20px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.config-section h2 {
  margin-bottom: 12px;
}
/* 日志管理页面：恢复默认 padding */
#admin-tab-7 .config-section {
  padding: 16px 20px !important;
}
/* 日志管理页面：确保标题和过滤栏不被遮挡 */
#admin-tab-7 .config-section-header {
  position: static !important;
  padding: 0 !important;
  margin-bottom: 12px !important;
  border-bottom: none !important;
  background: transparent !important;
}

.req-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
  overflow: hidden;
  min-width: 0;
}
.req-card h4 {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Tab System ===== */
.admin-tabs,
.hz-tabs,
.req-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--muted);
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0 8px;
  position: relative;
}

.admin-tab,
.hz-tab,
.req-tab {
  padding: 14px 20px;
  border: none;
  background: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: var(--transition-colors);
  font-family: inherit;
  outline: none;
  position: relative;
}
.admin-tab:hover, .hz-tab:hover, .req-tab:hover {
  color: var(--blue-600);
  background: var(--blue-50);
}
.admin-tab.active, .hz-tab.active, .req-tab.active {
  color: var(--blue-600);
  background: var(--blue-50);
  font-weight: 600;
}
.admin-tab.active::before, .hz-tab.active::before, .req-tab.active::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--blue-600);
  border-radius: 3px 3px 0 0;
  z-index: 1;
}

.admin-tab-content {
  display: none;
}
.admin-tab-content.active {
  display: block;
  margin-top: -1px;
}
.admin-tab-content.active > .config-section:first-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  padding-top: 4px;
}
/* 日志管理页面：恢复默认 padding */
#admin-tab-7.active > .config-section:first-child {
  padding-top: 16px;
}

/* ===== Dialog / Modal System ===== */
.req-modal-overlay,
.blog-detail-modal-overlay,
.blog-edit-modal-overlay,
.blog-cat-modal-overlay,
.fm-preview-modal-overlay,
.image-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fm-preview-modal-overlay {
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
}

.req-modal,
.blog-cat-modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px 32px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.req-modal { width: 560px; max-width: 95vw; }
.blog-cat-modal { width: 380px; max-width: 90vw; }

.req-modal h3,
.blog-cat-modal h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.req-modal-footer,
.blog-edit-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.req-modal-cancel {
  height: 36px;
  padding: 0 22px;
  background: var(--card);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: inherit;
  transition: var(--transition-colors);
  outline: none;
}
.req-modal-cancel:hover { background: var(--accent); }

.req-modal-confirm {
  height: 36px;
  padding: 0 22px;
  background: var(--blue-600);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: inherit;
  transition: var(--transition-colors);
  outline: none;
}
.req-modal-confirm:hover { background: var(--blue-700); }
.req-modal-confirm.danger-confirm { background: var(--destructive); }
.req-modal-confirm.danger-confirm:hover { background: rgba(212, 24, 61, 0.9); }

/* ===== Toast System ===== */
.req-toast,
.hz-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  z-index: 9999;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.req-toast.show, .hz-toast.show { opacity: 1; transform: translateY(0); }

.hz-toast.success { background: var(--green-600); color: white; }
.hz-toast.error { background: var(--destructive); color: white; }
.hz-toast.info { background: var(--blue-600); color: white; }
.req-toast { background: #323232; color: white; }

/* ===== Step 4: Navigation (Header) ===== */
.header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--card);
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  height: 64px;
  padding: 0 20px !important;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
}

.header h1 {
  margin: 0 !important;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--foreground);
  flex-shrink: 0;
  white-space: nowrap;
  border: none;
  padding: 0;
}

/* Menu (一级导航) */
.header > .menu {
  flex: 1;
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
  margin-left: 0;
}

.menu-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-600);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
  background: transparent;
}
.menu-btn:hover {
  background: var(--gray-100);
  color: var(--foreground);
}
.menu-btn.active {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}
.menu-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* "更多" 下拉菜单 */
.menu-more-wrap {
  position: relative;
  width: fit-content;
}

.menu-more-btn.menu-btn {
  padding: 0 12px;
}

.menu-more-dropdown {
  display: none;
  position: fixed;
  z-index: 1000;
  min-width: 110px;
  width: auto;
  white-space: nowrap;
  padding: 4px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.menu-more-dropdown.open {
  display: block;
  animation: dropdownFadeIn 0.2s ease;
}
.menu-more-item .menu-btn {
  width: 100%;
  text-align: left;
  white-space: nowrap;
  padding: 0 16px;
  height: 36px;
  border-radius: 4px;
  font-size: var(--text-sm);
}
.menu-more-item .menu-btn:hover {
  background: var(--blue-50);
  color: var(--blue-600);
}

/* User Area */
#user-area {
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0;
  position: static !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
  z-index: 101 !important;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-transform);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.user-avatar:hover { transform: scale(1.05); }
.user-avatar.guest {
  background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
  box-shadow: 0 2px 6px rgba(158, 158, 158, 0.3);
}
.user-avatar-text { color: white; font-size: var(--text-sm); font-weight: 600; }

.user-name {
  font-size: var(--text-sm);
  color: var(--foreground);
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
}
.user-name:hover { color: var(--blue-600); }
.user-name.guest { color: var(--gray-500); }
.user-name.guest:hover { color: var(--gray-600); }

/* 游客登录提示标签 */
.guest-wrapper { cursor: pointer; }
.login-hint {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--blue-600);
  cursor: pointer;
  margin-left: 8px;
  padding: 1px 10px;
  border: 1px solid var(--blue-300);
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.06);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.login-hint:hover {
  background: var(--blue-600);
  color: #fff;
  border-color: var(--blue-600);
}

/* User Dropdown */
.user-avatar-wrapper { position: relative; display: inline-flex; align-items: center; }

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  min-width: 140px;
  z-index: 2000;
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease;
}
.user-dropdown.show { display: block; }

.user-dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--foreground);
  transition: background 0.15s;
  white-space: nowrap;
}
.user-dropdown-item:hover { background: var(--gray-100); }

.user-dropdown-username {
  padding: 10px 16px;
  font-size: var(--text-xs);
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Step 5: Layout System ===== */
.homepage-container,
.documents-container,
.hz-page,
.req-page,
.admin-panel,
.ai-page {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  padding-top: 80px;
  box-sizing: border-box;
}
.ai-page { padding-left: 20px; padding-right: 20px; padding-bottom: 20px; }

/* admin-panel: header 不固定，全静态布局 */
.admin-panel {
  padding-top: 20px !important;
}
.admin-panel > .header,
.admin-panel .header {
  position: static !important;
  height: auto !important;
  padding: 0 20px 12px 20px !important;
  box-shadow: none !important;
  border-bottom: 1px solid var(--border);
  display: flex !important;
  align-items: center !important;
  gap: 16px;
  margin-left: calc(-20px - ((100vw - min(100vw, 1200px)) / 2) + 8px);
  margin-right: calc(-20px - ((100vw - min(100vw, 1200px)) / 2) + 8px);
}
/* admin-panel 内的 config-section-header 保持静态，不使用 sticky/fixed */
.admin-panel .config-section-header {
  position: static !important;
  top: auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 0;
}
.admin-panel .config-section {
  padding-top: 0 !important;
}

/* Sticky 二级元素 */
.config-section-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--card);
  padding: 10px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
}
.config-section-header h2 { margin: 0; }

.table-of-contents {
  position: sticky;
  top: 80px;
  z-index: 90;
  background: var(--card);
}

/* Hidden utility */
.hidden { display: none !important; }

/* ===== Step 6: Business Module Styles ===== */

/* --- 6.1 Homepage --- */
.homepage-content {
  margin-top: 20px;
  padding: 32px;
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  min-height: 300px;
}
.homepage-rich-content {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.8;
}
.homepage-rich-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* --- 6.2 Document Module --- */
.documents-container { padding: 20px; max-width: 1200px; margin: 0 auto; padding-top: 80px; }

.main-content {
  display: flex;
  gap: 24px;
}

.table-of-contents {
  width: 250px;
  min-width: 250px;
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.table-of-contents h3 {
  font-size: var(--text-base);
  color: var(--foreground);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.table-of-contents ul { list-style: none; }
.table-of-contents li { margin-bottom: 4px; }
.table-of-contents .toc-first > a {
  font-weight: 600;
  color: var(--blue-600);
  text-decoration: none;
  display: block;
  padding: 6px 0;
}
.table-of-contents .toc-first > a:hover { color: var(--blue-700); }
.table-of-contents .toc-second { padding-left: 16px; }
.table-of-contents .toc-second > a {
  color: var(--muted-foreground);
  text-decoration: none;
  display: block;
  padding: 4px 0;
  font-size: var(--text-sm);
}
.table-of-contents .toc-second > a:hover { color: var(--blue-600); }

.document-content {
  flex: 1;
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.document-section {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
  scroll-margin-top: 80px;
}
.document-section-header {
  background: var(--green-100);
  padding: 16px 24px;
  color: #166534;
}
.document-section-header h2 { margin: 0; font-size: var(--text-xl); font-weight: 600; color: #166534; }
.document-section-content { padding: 24px; }
.document-section-content .subsection {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.document-section-content .subsection:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.document-section-content .subsection h3 {
  margin: 0 0 12px 0;
  font-size: var(--text-base);
  color: var(--foreground);
  padding: 8px 12px;
  background: var(--green-50);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius-sm);
}
.document-section-content .subsection .content {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.8;
  padding-left: 16px;
}

.first-title {
  font-size: var(--text-3xl);
  color: var(--foreground);
  margin-top: 32px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-600);
}
.first-title:first-child { margin-top: 0; }
.second-title { font-size: var(--text-xl); color: var(--foreground); margin-top: 20px; margin-bottom: 10px; }
.second-title a { color: var(--blue-600); text-decoration: none; }
.second-title a:hover { text-decoration: underline; }
.document-content .content {
  font-size: var(--text-base);
  color: var(--muted-foreground);
  line-height: 1.8;
  margin-bottom: 16px;
  padding-left: 20px;
}

/* --- 6.3 Rich Text Editor --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: none;
}
.toolbar-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--foreground);
  transition: all 0.15s;
}
.toolbar-btn:hover { background: var(--blue-50); border-color: var(--blue-600); color: var(--blue-600); }
.toolbar-btn[title="全屏编辑"] { background: var(--accent); }
.toolbar-btn[title="全屏编辑"]:hover { background: var(--blue-600); border-color: var(--blue-600); }
.toolbar-btn[title="全屏编辑"]:hover svg { stroke: #fff; }
.toolbar-separator { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.color-picker { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; padding: 0; }
.color-picker::-webkit-color-swatch-wrapper { padding: 2px; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 2px; }

.color-panel { display: none; min-width: 140px; }
.color-panel.open { display: block; }
.color-swatch:hover { border-color: var(--foreground) !important; transform: scale(1.15); transition: transform 0.15s; }

.content-editor {
  max-height: 60px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--foreground);
  outline: none;
  overflow: hidden;
  transition: max-height 0.3s;
  box-sizing: border-box;
  direction: ltr;
  text-align: left;
  cursor: text;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.content-editor * { max-width: 100%; word-break: break-word; overflow-wrap: anywhere; }
.content-editor img { max-width: 100%; height: auto; display: block; }
.content-editor a { word-break: break-all; overflow-wrap: anywhere; }
.content-editor pre, .content-editor code { white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; }
.content-editor.expanded { max-height: 400px; }
.content-editor:empty:before { content: attr(placeholder); color: var(--gray-500); pointer-events: none; }
.content-editor.req-desc-editor { max-height: none; min-height: 120px; border: none; border-top: 1px solid var(--border); }
.content-editor.homepage-config-editor { max-height: 400px; overflow-y: auto; }
.content-editor.homepage-config-editor.expanded { max-height: none; overflow-y: visible; }
.req-editing .content-editor.req-desc-editor { max-height: none; }

.toggle-content-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  background: var(--gray-100);
  color: var(--blue-600);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  font-family: inherit;
}
.toggle-content-btn:hover { background: var(--blue-50); border-color: var(--blue-100); }

/* Fullscreen editor */
#fullscreen-editor-modal { font-family: inherit; }
#fullscreen-editor-modal #fullscreen-editor-area { overflow-y: auto; }
#fullscreen-editor-modal #fullscreen-editor-area img { max-width: 100%; height: auto; }
#fullscreen-editor-modal #fullscreen-editor-area a { color: var(--blue-600); word-break: break-all; }

/* --- 6.4 Document List (Config) --- */
.document-list { margin-top: 20px; }
.document-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  background: var(--gray-50);
  cursor: move;
  transition: all 0.15s;
  overflow: hidden;
}
.document-row:hover { background: var(--gray-100); }
.document-row.dragging { opacity: 0.5; border-color: var(--blue-600); }

.row-header {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.row-header input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  background: var(--input-background);
  color: var(--foreground);
  outline: none;
  height: 36px;
  font-family: inherit;
}
.row-header input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

/* Green tint for config inputs */
#hzsystem-doc-list .row-header input,
#ai-doc-list .row-header input,
#document-list .row-header input { background: var(--green-50); }
#hzsystem-doc-list .row-header input:first-child,
#ai-doc-list .row-header input:first-child,
#document-list .row-header input:first-child { background: var(--green-100); }

.row-header input.first-title-input { flex: 1.5; }
.row-header input.second-title-input { flex: 1.5; }

.row-content { padding: 16px; }

.row-number {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-600); color: white;
  border-radius: var(--radius-sm); font-weight: 600; font-size: var(--text-xs);
  flex-shrink: 0;
}

.move-control { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.position-input { width: 50px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); text-align: center; }
.move-btn { padding: 6px 10px; background: var(--blue-600); color: white; border: none; border-radius: var(--radius-sm); font-size: var(--text-sm); cursor: pointer; }
.move-btn:hover { background: var(--blue-700); }

.drag-handle { cursor: grab; padding: 8px; color: var(--gray-500); font-size: var(--text-xl); }

/* --- 6.5 Password Panel --- */
.password-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
.password-form {
  background: var(--card);
  padding: 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  text-align: center;
  width: 350px;
}
.password-form h2 { margin-bottom: 20px; }
.password-hint { color: var(--muted-foreground); margin-bottom: 20px; font-size: var(--text-sm); }
#password-input {
  width: 100%;
  padding: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  background: var(--input-background);
  height: auto;
}
#password-input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
#submit-btn { width: 100%; margin-top: 0; }
.error-message { color: var(--destructive); margin-top: 16px; font-size: var(--text-sm); }

/* --- 6.6 Requirements Module --- */
.req-page { max-width: 1200px; margin: 0 auto; padding: 20px; padding-top: 80px; }

/* Status tags */
.req-status { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.req-status-draft  { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.req-status-active { background: var(--green-100); color: #166534; border: 1px solid #a5d6a7; }
.req-status-pending { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.req-status-processing { background: #f3e8ff; color: #7c3aed; border: 1px solid #d8b4fe; }
.req-status-closed { background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); }

/* Priority tags */
.req-priority { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 600; }
.req-priority-urgent { background: #fce4ec; color: #c62828; }
.req-priority-normal { background: var(--blue-100); color: var(--blue-600); }
.req-priority-low    { background: var(--purple-100); color: var(--purple-600); }

/* 需求类型标签 */
.req-type-tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.req-type-sys      { background: #eceff1; color: #546e7a; border: 1px solid #cfd8dc; }   /* 系统问题-灰蓝 */
.req-type-analysis { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }   /* 需求分析-蓝 */
.req-type-dev      { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }   /* 功能开发-绿 */
.req-type-qa       { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }   /* 用户答疑-橙 */
.req-type-biz      { background: #f3e5f5; color: #7b1fa2; border: 1px solid #ce93d8; }   /* 业务协作-紫 */

/* 归属系统标签 */
.belong-system-hr         { background: #e8eaf6; color: #283593; border: 1px solid #9fa8da; }  /* 红海云EHR */
.belong-system-attendance { background: #e0f7fa; color: #00695c; border: 1px solid #80deea; }  /* 考勤/访客 */
.belong-system-hr-internal { background: #fff3e0; color: #e65100; border: 1px solid #ffb74d; }  /* 内部红海云 */
.belong-system-internal   { background: #fce4ec; color: #880e4f; border: 1px solid #f48fb1; }  /* 内部其他 */

/* Toolbar */
.req-toolbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; gap: 16px; }
.req-search-wrap { flex: 1; max-width: 360px; display: flex; align-items: flex-end; gap: 8px; }
.req-search-input-wrap { position: relative; flex: 1; display: flex; }
.req-search-input {
  flex: 1;
  padding: 9px 28px 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--foreground);
  background: var(--card);
  line-height: 1.4;
  box-sizing: border-box;
  height: 36px;
}
.req-search-input:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.req-search-clear {
  display: none;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: 50%;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}
.req-search-clear:hover { color: var(--gray-600); background: var(--gray-100); }
.req-search-clear.show { display: block; }
.req-search-btn {
  padding: 9px 16px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--blue-600);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.req-search-btn:hover { background: var(--blue-700); }

/* Table */
.req-table-wrap { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: auto; }
/* 日志管理：固定表头、表格体滚动 */
#admin-tab-7 .req-table-wrap {
  max-height: calc(100vh - 240px);
  overflow: auto;
}
#admin-tab-7 .req-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
#admin-tab-7 .req-table thead th {
  background: var(--card);
  border-bottom: 2px solid var(--muted);
}
/* 日志表格列宽优化 */
#admin-tab-7 .req-table th:nth-child(6),
#admin-tab-7 .req-table td:nth-child(6) {
  min-width: 180px;
  max-width: 300px;
}
#admin-tab-7 .req-table th:nth-child(9),
#admin-tab-7 .req-table td:nth-child(9) {
  min-width: 140px;
  max-width: 250px;
}
.req-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.req-table thead { background: var(--gray-100); }
.req-table th { padding: 12px 14px; text-align: left; color: var(--gray-600); font-weight: 600; border-bottom: 2px solid var(--muted); white-space: nowrap; }
/* 默认隐藏关闭日期/原因列，JS在切换到"全部"/"已关闭"时给父容器加 .show-close-cols 显示 */
.req-table .th-close-date,
.req-table .th-close-reason { display: none; }
.show-close-cols .th-close-date,
.show-close-cols .th-close-reason { display: table-cell; }
/* 已关闭Tab：隐藏状态和创建时间列 */
.show-close-cols .th-status,
.show-close-cols .th-created-at { display: none; }
/* 处理中Tab：隐藏来源和来源备注列 */
.hide-source-cols .req-table th:nth-child(7),
.hide-source-cols .req-table th:nth-child(8),
.hide-source-cols .req-table td:nth-child(7),
.hide-source-cols .req-table td:nth-child(8) { display: none; }
/* 工单列默认隐藏，仅处理中Tab显示 */
.req-table .th-work-order,
.req-table .td-work-order { display: none; }
.hide-source-cols .th-work-order,
.hide-source-cols .td-work-order { display: table-cell; }
.req-table td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; color: var(--foreground); }
.req-table tbody tr:hover { background: var(--blue-50); }
.req-table tbody tr:last-child td { border-bottom: none; }

/* ===== 表头筛选 ===== */
.req-table th { position: relative; overflow: visible; }
.filter-icon {
  display: inline-block; margin-left: 3px; font-size: 11px; color: var(--gray-400);
  cursor: pointer; transition: color 0.15s; vertical-align: middle; user-select: none;
}
.filter-icon:hover { color: var(--blue-500); }
.filter-icon.active { color: var(--blue-600); }
/* 有激活筛选时显示圆点标记 */
.filter-icon[data-has-filter]::before { content: '●'; margin-right: 2px; font-size: 7px; vertical-align: super; color: var(--blue-500); }

/* 表头排序按钮 */
.sort-updated-at-btn {
  display: inline-block; margin-left: 3px; font-size: 11px; color: var(--gray-400);
  cursor: pointer; transition: color 0.15s; vertical-align: middle; user-select: none;
}
.sort-updated-at-btn:hover { color: var(--blue-500); }
.sort-updated-at-btn.active { color: var(--blue-600); }

/* 筛选下拉面板（渲染在 th 内部，利用 th 的 position:relative 定位） */
.filter-dropdown {
  position: absolute; top: 100%; left: 0; min-width: 200px; max-width: 280px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 200; animation: filterFadeIn 0.12s ease;
}
@keyframes filterFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.filter-dd-actions {
  display: flex; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--gray-100);
}
.filter-action-link {
  background: none; border: none; color: var(--blue-600); font-size: 0.82rem;
  cursor: pointer; padding: 0; font-family: inherit;
}
.filter-action-link:hover { text-decoration: underline; }

.filter-dd-body { padding: 6px 0; max-height: 220px; overflow-y: auto; }

.filter-text-input {
  width: 100%; padding: 8px 12px; border: none; border-bottom: 1px solid var(--gray-100);
  font-size: var(--text-sm); color: var(--foreground); background: transparent; outline: none;
  box-sizing: border-box; font-family: inherit;
}
.filter-text-input:focus { border-bottom-color: var(--blue-500); }

.filter-checkbox-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer;
  font-size: var(--text-sm); color: var(--foreground); transition: background 0.1s; user-select: none;
}
.filter-checkbox-item:hover { background: var(--gray-50); }
.filter-checkbox-item input[type="checkbox"] { accent-color: var(--blue-600); width: 15px; height: 15px; cursor: pointer; }
.filter-checkbox-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filter-dd-footer { padding: 6px 12px; border-top: 1px solid var(--gray-100); }
.filter-clear-btn {
  background: none; border: none; color: var(--gray-500); font-size: 0.8rem;
  cursor: pointer; padding: 2px 0; font-family: inherit;
}
.filter-clear-btn:hover { color: var(--red-600); }

.req-name-link { color: var(--blue-600); text-decoration: none; font-weight: 500; cursor: pointer; }
.req-name-link:hover { text-decoration: underline; }

/* Action buttons (需求列表) */
.req-actions { display: flex; gap: 10px; flex-wrap: nowrap; align-items: center; justify-content: flex-end; }
.req-btn { padding: 5px 12px; font-size: 0.82rem; border-radius: var(--radius-sm); border: 1px solid; cursor: pointer; white-space: nowrap; transition: all 0.15s; background: var(--card); font-family: inherit; }
.req-btn-edit { color: var(--blue-600); border-color: var(--blue-100); }
.req-btn-edit:hover { background: var(--blue-50); }
.req-btn-close { color: #f57c00; border-color: #ffcc80; }
.req-btn-close:hover { background: #fff8e1; }
.req-btn-reactivate { color: var(--green-600); border-color: #a5d6a7; }
.req-btn-reactivate:hover { background: var(--green-50); }
.req-btn-danger { color: var(--destructive); border-color: #ef9a9a; }
.req-btn-danger:hover { background: #ffebee; }

/* More menu */
.req-more-wrap { position: relative; }
.req-btn-more { color: var(--muted-foreground); border-color: var(--border); padding: 5px 8px; }
.req-btn-more:hover { background: var(--gray-100); }
.req-btn-more::after { content: ' ▾'; font-size: 0.7rem; }
.req-more-menu { display: none; position: fixed; z-index: 9999; min-width: 110px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 4px 0; }
.req-more-menu.open { display: block; }
.req-more-item { display: block; width: 100%; padding: 7px 14px; font-size: 0.82rem; border: none; background: none; cursor: pointer; text-align: left; transition: background 0.15s; font-family: inherit; }
.req-more-item:hover { background: var(--blue-50); }
.req-more-close { color: var(--destructive); }
.req-more-close:hover { background: #ffebee; }
.req-more-reactivate { color: var(--green-600); }
.req-more-reactivate:hover { background: var(--green-50); }
.req-more-note { color: var(--blue-600); }
.req-more-note:hover { background: var(--blue-50); }

/* Pagination */
.req-pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; margin-top: 8px; border-top: 1px solid var(--border); }
.req-pagination-info { font-size: var(--text-sm); color: var(--gray-500); }
.req-pagination-controls { display: flex; align-items: center; gap: 8px; }
.req-pagination-size { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--gray-600); cursor: pointer; background: var(--card); }
.req-pagination-btn { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); font-size: var(--text-sm); color: var(--gray-600); cursor: pointer; font-family: inherit; transition: var(--transition-colors); }
.req-pagination-btn:hover:not(:disabled) { background: var(--gray-100); }
.req-pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.req-pagination-page { font-size: var(--text-sm); color: var(--muted-foreground); padding: 0 8px; white-space: nowrap; }
.req-pagination-btn { white-space: nowrap; }

/* Empty state */
.req-empty { text-align: center; padding: 60px 20px; color: var(--gray-500); }

/* Form groups */
.req-form-group { margin-bottom: 16px; }
.req-form-group label { display: block; font-size: var(--text-sm); color: var(--gray-600); margin-bottom: 6px; font-weight: 600; }
.req-form-group input, .req-form-group select, .req-form-group textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--foreground); font-family: inherit; background: var(--card); transition: var(--transition-colors); }
.req-form-group input:focus, .req-form-group select:focus, .req-form-group textarea:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

/* Detail page */
.req-detail-page { padding: 20px; max-width: 1200px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.req-detail-layout { display: flex; gap: 20px; align-items: flex-start; width: 100%; }
.req-detail-main { flex: 1; min-width: 0; overflow: hidden; }
.req-detail-sidebar { width: 280px; min-width: 280px; }
.req-detail-title { font-size: var(--text-xl); font-weight: 600; color: var(--foreground); word-break: break-word; overflow-wrap: anywhere; }
.req-info-row { display: flex; margin-bottom: 10px; font-size: var(--text-sm); }
.req-info-label { width: 80px; min-width: 80px; color: var(--gray-500); font-size: var(--text-sm); }
.req-info-value { color: var(--foreground); flex: 1; min-width: 0; word-break: break-word; overflow-wrap: anywhere; }

/* view-desc 富文本内容防溢出 */
#view-desc * { max-width: 100%; word-break: break-word !important; overflow-wrap: anywhere !important; white-space: normal !important; text-wrap: wrap !important; text-wrap-mode: wrap !important; box-sizing: border-box; }
#view-desc img { max-width: 100%; height: auto; display: block; }
#view-desc a { word-break: break-all; overflow-wrap: anywhere; }
#view-desc pre, #view-desc code { white-space: pre-wrap !important; word-break: break-all; overflow-wrap: anywhere; }

/* Timeline */
.req-timeline { position: relative; padding-left: 20px; }
.req-timeline-item { position: relative; padding: 0 0 20px 20px; }
.req-timeline-item:last-child { padding-bottom: 0; }
.req-timeline-dot { position: absolute; left: -8px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid white; }
.req-timeline-dot-create    { background: var(--blue-600); box-shadow: 0 0 0 2px var(--blue-100); }
.req-timeline-dot-edit      { background: #f59e0b; box-shadow: 0 0 0 2px #fde68a; }
.req-timeline-dot-note      { background: var(--green-600); box-shadow: 0 0 0 2px var(--green-100); }
.req-timeline-dot-close     { background: var(--muted-foreground); box-shadow: 0 0 0 2px var(--muted); }
.req-timeline-dot-reactivate{ background: var(--purple-600); box-shadow: 0 0 0 2px var(--purple-100); }
.req-timeline-time { font-size: var(--text-xs); color: var(--gray-500); margin-bottom: 3px; }
.req-timeline-type { display: inline-block; font-size: 0.75rem; padding: 1px 7px; border-radius: 10px; margin-right: 6px; font-weight: 600; background: var(--muted); color: var(--muted-foreground); }
.req-timeline-operator { display: inline-block; font-size: 0.75rem; color: var(--gray-500); margin-right: 6px; }
.req-timeline-content { display: block; font-size: var(--text-sm); color: var(--gray-700); line-height: 1.6; margin-top: 4px; word-break: break-word; overflow-wrap: anywhere; white-space: normal; max-width: 100%; }
.req-timeline-content * { word-break: break-word !important; overflow-wrap: anywhere !important; white-space: normal !important; text-wrap: wrap !important; text-wrap-mode: wrap !important; max-width: 100%; }
.req-timeline-content img { cursor: pointer; transition: var(--transition-opacity); }
.req-timeline-content img:hover { opacity: 0.85; }

/* Note area */
.req-note-area { display: flex; flex-direction: column; gap: 10px; }
.req-note-area textarea { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); font-family: inherit; resize: vertical; min-height: 70px; background: var(--card); transition: var(--transition-colors); }
.req-note-area textarea:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.req-note-submit { padding: 10px 18px; background: var(--blue-600); color: white; border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); white-space: nowrap; font-family: inherit; transition: var(--transition-colors); }
.req-note-submit:hover { background: var(--blue-700); }

/* Edit/view field toggle */
.req-edit-field { display: none; }
.req-editing .req-view-field { display: none; }
.req-editing .req-edit-field { display: block; }
/* 右侧属性栏始终可编辑模式 */
.sidebar-editable .req-view-field { display: none; }
.sidebar-editable .req-edit-field { display: block; }
/* 已关闭状态下，仅归属系统可编辑，其余字段灰化 */
.req-detail-sidebar select:disabled,
.req-detail-sidebar input:disabled {
  background: #f0f0f0 !important;
  color: #999 !important;
  cursor: not-allowed !important;
}

/* Detail page header bar */
.req-detail-header-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.req-detail-back-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; background: var(--card); color: var(--gray-600); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); font-family: inherit; transition: var(--transition-colors); flex-shrink: 0; }
.req-detail-back-btn:hover { background: var(--gray-100); color: var(--foreground); }
.req-detail-back-btn svg { flex-shrink: 0; }

/* Note card header */
.req-note-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.req-note-header h4 { margin: 0; }
.req-note-actions { display: flex; align-items: center; gap: 8px; }

/* Detail action buttons */
.req-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.req-detail-action-btn { padding: 8px 18px; font-size: var(--text-sm); border-radius: var(--radius-sm); border: 1px solid; cursor: pointer; transition: var(--transition-colors); font-family: inherit; }
.req-action-edit { background: var(--blue-600); color: white; border-color: var(--blue-700); }
.req-action-edit:hover { background: var(--blue-700); }
.req-action-save { background: var(--green-600); color: white; border-color: var(--green-700); }
.req-action-save:hover { background: var(--green-700); }
.req-action-cancel { background: var(--card); color: var(--muted-foreground); border-color: var(--border); }
.req-action-cancel:hover { background: var(--gray-100); }
.req-action-close { background: var(--card); color: #f57c00; border-color: #ffcc80; }
.req-action-close:hover { background: #fff8e1; }
.req-action-reactivate { background: var(--card); color: var(--green-600); border-color: #a5d6a7; }
.req-action-reactivate:hover { background: var(--green-50); }

/* --- 6.7 HzSystem Module --- */
.hz-page { padding: 20px; max-width: 1200px; margin: 0 auto; padding-top: 80px; }
.hz-content { background: var(--card); border-radius: 0 0 var(--radius-lg) var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 24px; min-height: 400px; }
.hz-panel { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.hz-card { max-width: 600px; }
.hz-card h3 { font-size: var(--text-base); color: var(--foreground); margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.hz-form-group { margin-bottom: 18px; }
.hz-form-group label { display: block; font-size: var(--text-sm); color: var(--gray-600); margin-bottom: 6px; font-weight: 600; }
.hz-form-group input, .hz-form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--foreground); font-family: inherit; background: var(--card); transition: var(--transition-colors); }
.hz-form-group input:focus, .hz-form-group textarea:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

/* Switch */
.hz-switch { position: relative; display: inline-block; width: 50px; height: 26px; cursor: pointer; }
.hz-switch input { opacity: 0; width: 0; height: 0; }
.hz-slider { position: absolute; cursor: pointer; inset: 0; background: var(--muted); transition: 0.3s; border-radius: 26px; }
.hz-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; transition: 0.3s; border-radius: 50%; }
.hz-switch input:checked + .hz-slider { background: var(--blue-600); }
.hz-switch input:checked + .hz-slider:before { transform: translateX(24px); }

/* Log list */
.hz-log-list { max-height: 500px; overflow-y: auto; }
.hz-log-item { display: flex; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--gray-100); transition: background 0.15s; }
.hz-log-item:hover { background: var(--blue-50); }
.hz-log-item:last-child { border-bottom: none; }
.hz-log-time { font-size: var(--text-sm); color: var(--gray-500); white-space: nowrap; min-width: 160px; }
.hz-log-action { font-size: var(--text-sm); color: var(--foreground); }

/* --- 6.8 Menu Management --- */
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--gray-50); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.menu-level-badge { padding: 4px 8px; background: var(--blue-100); color: var(--blue-600); border-radius: var(--radius-sm); font-size: var(--text-xs); min-width: 80px; text-align: center; font-weight: 600; }
.menu-key-label { font-family: monospace; color: var(--muted-foreground); font-size: var(--text-sm); min-width: 120px; }
.menu-label-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); background: var(--card); color: var(--foreground); }
.menu-label-input:focus { outline: none; border-color: var(--blue-600); }

/* --- 6.9 Password Management --- */
.password-list { display: flex; flex-direction: column; gap: 16px; }
.password-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.password-card-header { padding: 12px 16px; background: var(--gray-50); border-bottom: 1px solid var(--border); }
.password-card-label { font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
.password-card-body { padding: 16px; }
.password-mode-group { display: flex; gap: 20px; margin-bottom: 12px; }
.password-radio { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: var(--text-sm); color: var(--gray-600); }
.password-radio input[type="radio"] { cursor: pointer; accent-color: var(--blue-600); }
.password-value-row { display: flex; align-items: center; gap: 8px; }
.password-value-row label { font-size: var(--text-sm); color: var(--gray-500); flex-shrink: 0; }
.password-value-input { flex: 1; max-width: 240px; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); background: var(--card); color: var(--foreground); outline: none; font-family: inherit; }
.password-value-input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.password-dynamic-hint { font-size: var(--text-sm); color: var(--gray-500); padding: 8px 0; }
.password-dynamic-hint strong { color: var(--blue-700); }
.force-reauth-row { display: flex; align-items: center; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.force-reauth-label { font-size: var(--text-sm); color: var(--gray-500); flex-shrink: 0; }

.config-perm-btn { padding: 5px 12px; border: 1px solid var(--green-600); border-radius: var(--radius-sm); background: var(--card); color: var(--green-600); cursor: pointer; font-size: var(--text-sm); transition: all 0.15s; font-family: inherit; }
.config-perm-btn:hover { background: var(--green-600); color: var(--card); }

/* Eye button */
.pwd-eye-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--gray-500); padding: 2px; display: inline-flex; align-items: center; justify-content: center; transition: var(--transition-colors); z-index: 1; }
.pwd-eye-btn:hover { color: var(--blue-600); }
.password-value-input { padding-right: 32px !important; }
input::-ms-reveal, input::-ms-clear { display: none !important; }

/* --- 6.10 Permission Tree --- */
.perm-tree-group { margin-bottom: 12px; }
.perm-tree-group:last-child { margin-bottom: 0; }
.perm-item { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--text-sm); color: var(--gray-700); padding: 4px 0; }
.perm-item input[type="checkbox"] { cursor: pointer; accent-color: var(--green-600); width: 16px; height: 16px; }
.perm-parent { font-weight: 600; color: var(--foreground); padding: 6px 0; }
.perm-parent span { border-bottom: 1px solid var(--gray-100); width: 100%; padding-bottom: 4px; }
/* 父级半选状态：方框样式，区别于全选勾和未选 */
.perm-parent-cb:indeterminate { accent-color: var(--gray-400); }
.perm-parent-cb:indeterminate + span { color: var(--gray-500); }
.perm-children { padding-left: 28px; margin-top: 2px; }
.perm-child { font-size: var(--text-sm); color: var(--gray-600); }

/* --- 6.11 User Management --- */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(200px, auto) auto; align-items: center; padding: 14px 18px; background: var(--gray-50); border: 1px solid var(--border); border-radius: var(--radius-sm); gap: 16px; }
.user-row .user-password-wrap,
.user-row .user-actions { display: flex; align-items: center; }
.user-info { display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.user-info strong { font-size: var(--text-base); color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-date { font-size: var(--text-xs); color: var(--gray-500); }
.user-actions { display: flex; gap: 10px; }

.change-pwd-btn { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; font-size: var(--text-sm); color: var(--gray-600); transition: all 0.15s; font-family: inherit; }
.change-pwd-btn:hover { background: var(--gray-100); border-color: var(--blue-600); color: var(--blue-600); }
.delete-user-btn { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; font-size: var(--text-sm); color: var(--destructive); transition: all 0.15s; font-family: inherit; }
.delete-user-btn:hover { background: #ffebee; border-color: var(--destructive); }

/* User password field */
.user-password-field { position: relative; display: flex; align-items: center; }
.user-password-input { flex: 1; padding: 6px 32px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); background: var(--gray-50); color: var(--muted-foreground); width: 100%; font-family: inherit; }
.user-password-input:focus { outline: none; border-color: var(--blue-600); background: var(--card); }
.user-pwd-eye-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--gray-500); padding: 2px; display: inline-flex; align-items: center; justify-content: center; transition: var(--transition-colors); }
.user-pwd-eye-btn:hover { color: var(--blue-600); }

/* --- 6.12 Log Management --- */
.log-user-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: var(--text-xs); font-weight: 600; }
.log-user-badge.guest { background: #fff3e0; color: #e65100; }
.log-user-badge.registered { background: var(--green-100); color: #166534; }

/* 日志管理：标题与过滤栏分两行，不吸顶 */
#admin-tab-7 .config-section-header {
  flex-wrap: wrap;
  position: static !important;
  z-index: 1;
  background: transparent !important;
  padding: 0 !important;
  margin-bottom: 12px;
  border-bottom: none !important;
  width: 100% !important;
  max-width: none !important;
}
#admin-tab-7 .config-section-header h2 {
  width: 100%;
  margin-bottom: 10px;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--foreground);
}
.log-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.log-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.log-filter-input, .log-filter-select, .log-filter-keyword {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: var(--text-sm); height: 36px; box-sizing: border-box; line-height: 1.4;
  background: var(--card); color: var(--foreground);
}
.log-filter-input { width: 140px; }
.log-filter-datetime { width: 180px; }
.log-filter-select { min-width: 100px; width: auto; flex-shrink: 0; }
.log-filter-keyword { width: 160px; }
.log-filter-sep { line-height: 36px; color: var(--gray-500); font-size: var(--text-sm); }

.log-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}
.log-btn:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); }

/* 搜索 → Primary */
.log-btn-search {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}
.log-btn-search:hover { background: var(--blue-700); }

/* 导出 → Secondary (浅灰底) */
.log-btn-export {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--secondary);
}
.log-btn-export:hover { background: rgba(237, 237, 243, 0.8); }

/* 清除 → Destructive */
.log-btn-clear {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}
.log-btn-clear:hover { background: rgba(212, 24, 61, 0.9); }

/* 更多下拉菜单 */
.log-more-dropdown { position: relative; display: inline-block; }
.log-btn-more {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--secondary);
}
.log-btn-more:hover { background: rgba(237, 237, 243, 0.8); }
.log-more-menu {
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 120px;
  z-index: 9999;
  overflow: hidden;
}
.log-more-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: var(--text-sm);
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.log-more-item:hover { background: var(--gray-50); }
.log-more-item-danger { color: var(--destructive); }
.log-more-item-danger:hover { background: rgba(212, 24, 61, 0.08); }

/* --- 6.13 Myblog Module --- */
.myblog-layout { display: flex; gap: 20px; align-items: flex-start; }
.myblog-sidebar { width: 280px; min-width: 280px; background: var(--card); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.myblog-sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.myblog-sidebar-header h3 { font-size: var(--text-base); color: var(--foreground); }
.myblog-main { flex: 1; min-width: 0; }
.myblog-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.myblog-toolbar h3 { font-size: var(--text-base); color: var(--foreground); }

.category-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; margin-bottom: 4px; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; color: var(--gray-700); font-size: var(--text-sm); }
.category-item:hover { background: var(--blue-50); }
.category-item.active { background: var(--blue-100); color: var(--blue-600); font-weight: 600; }
.category-item .category-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-item .category-actions { display: none; gap: 4px; flex-shrink: 0; }
.category-item:hover .category-actions { display: flex; }
.category-action-btn { padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--card); font-size: 0.75rem; cursor: pointer; color: var(--muted-foreground); transition: all 0.15s; font-family: inherit; }
.category-action-btn:hover { background: var(--gray-100); border-color: var(--blue-600); }
.category-action-btn.edit-cat:hover { color: var(--blue-600); }
.category-action-btn.del-cat:hover { color: var(--destructive); border-color: var(--destructive); }

.article-title-link { color: var(--blue-600); text-decoration: none; font-weight: 500; cursor: pointer; }
.article-title-link:hover { text-decoration: underline; }
.myblog-empty { text-align: center; padding: 60px 20px; color: var(--gray-500); }

/* Blog detail modal */
.blog-detail-modal { background: var(--card); border-radius: var(--radius-lg); width: 700px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.blog-detail-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 28px 16px; border-bottom: 1px solid var(--border); }
.blog-detail-title { font-size: var(--text-xl); font-weight: 600; color: var(--foreground); flex: 1; margin-right: 20px; }
.blog-detail-meta { display: flex; gap: 16px; padding: 12px 28px; background: var(--gray-50); font-size: var(--text-sm); color: var(--gray-500); border-bottom: 1px solid var(--border); }
.blog-detail-content { padding: 24px 28px; font-size: var(--text-sm); color: var(--foreground); line-height: 1.8; }
.blog-detail-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* Blog edit modal */
.blog-edit-modal { background: var(--card); border-radius: var(--radius-lg); width: 750px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.blog-edit-modal h3 { font-size: var(--text-base); color: var(--foreground); padding: 20px 24px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.blog-edit-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.blog-edit-body .content-editor { max-height: none; min-height: 250px; border-top: 1px solid var(--border); }

.blog-category-select { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--foreground); background: var(--card); font-family: inherit; cursor: pointer; }
.blog-category-select:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

/* Blog fullscreen detail */
.blog-detail-fullscreen { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.blog-detail-nav { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; border-bottom: 1px solid var(--border); background: var(--gray-50); }
.blog-detail-body { padding: 28px; }
.blog-detail-body .blog-detail-title { font-size: var(--text-2xl); font-weight: 600; color: var(--foreground); margin-bottom: 16px; }
.blog-detail-body .blog-detail-meta { display: flex; flex-wrap: wrap; gap: 16px; padding: 14px 18px; background: var(--gray-50); border-radius: var(--radius-lg); font-size: var(--text-sm); color: var(--gray-500); margin-bottom: 24px; }
.blog-detail-body .blog-detail-content { font-size: var(--text-sm); color: var(--foreground); line-height: 1.8; }
.blog-detail-body .blog-detail-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); cursor: zoom-in; }

/* --- 6.14 File Manager Module --- */
.fm-layout { display: flex; gap: 20px; align-items: flex-start; }
.fm-sidebar { width: 280px; min-width: 280px; background: var(--card); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.fm-sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.fm-sidebar-header h3 { font-size: var(--text-base); color: var(--foreground); }
.fm-main { flex: 1; min-width: 0; }
.fm-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.fm-folder-tree { font-size: var(--text-sm); }
.fm-tree-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; color: var(--gray-700); user-select: none; }
.fm-tree-item:hover { background: var(--blue-50); }
.fm-tree-item.active { background: var(--blue-100); color: var(--blue-600); font-weight: 600; }
.fm-tree-icon { font-size: var(--text-base); width: 20px; text-align: center; flex-shrink: 0; }
.fm-tree-children { padding-left: 20px; }

.fm-file-row { transition: background 0.15s; cursor: default; }
.fm-file-row td { padding: 10px 14px; vertical-align: middle; }
.fm-file-row:hover { background: var(--blue-50); }
.fm-file-icon { width: 30px; font-size: var(--text-xl); text-align: center; flex-shrink: 0; margin-right: 10px; }
.fm-file-name { font-size: var(--text-sm); color: var(--foreground); word-break: break-all; }
.fm-file-name.previewable { color: var(--blue-600); cursor: pointer; }
.fm-file-name.previewable:hover { text-decoration: underline; }
.fm-file-size { text-align: right; font-size: var(--text-xs); color: var(--gray-500); }
.fm-file-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.fm-action-btn { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); font-size: 0.78rem; cursor: pointer; color: var(--muted-foreground); transition: all 0.15s; white-space: nowrap; line-height: 1.4; font-family: inherit; }
.fm-action-btn:hover { background: var(--gray-100); }
.fm-action-btn.download:hover { color: var(--green-600); border-color: var(--green-600); }
.fm-action-btn.preview:hover { color: var(--blue-600); border-color: var(--blue-600); }
.fm-action-btn.delete:hover { color: var(--destructive); border-color: var(--destructive); }
.fm-action-btn.rename:hover { color: var(--blue-600); border-color: var(--blue-600); }

/* File preview modal */
.fm-preview-modal { background: var(--card); border-radius: var(--radius-lg); width: 800px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); }
.fm-preview-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.fm-preview-header h3 { font-size: var(--text-base); color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.fm-preview-body { flex: 1; overflow: auto; padding: 20px; display: flex; align-items: center; justify-content: center; min-height: 300px; background: var(--gray-50); }
.fm-preview-body img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius-sm); }
.fm-preview-body iframe { width: 100%; height: 70vh; border: none; border-radius: var(--radius-sm); }
.fm-preview-nav { display: flex; gap: 10px; align-items: center; }

.fm-back-root { font-size: var(--text-sm); color: var(--blue-600); cursor: pointer; margin-left: 8px; }
.fm-back-root:hover { text-decoration: underline; }

/* ===== 上传队列面板 ===== */
.fm-upload-queue-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.35); z-index: 10000; display: flex; justify-content: flex-end; align-items: flex-start; }
.fm-upload-queue-panel { width: 420px; max-height: 100vh; background: var(--card); box-shadow: -4px 0 24px rgba(0,0,0,0.15); display: flex; flex-direction: column; animation: fmSlideInRight 0.25s ease; }
@keyframes fmSlideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.fm-queue-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.fm-queue-header h3 { font-size: var(--text-base); color: var(--foreground); margin: 0; }
.fm-queue-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #888; padding: 4px 8px; border-radius: 4px; }
.fm-queue-close:hover { background: var(--gray-100); }
.fm-queue-body { flex: 1; overflow-y: auto; padding: 12px 0; }
.fm-queue-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--gray-100); }
.fm-queue-item:last-child { border-bottom: none; }
.fm-queue-item-icon { font-size: 1.1rem; width: 24px; text-align: center; flex-shrink: 0; }
.fm-queue-item-info { flex: 1; min-width: 0; }
.fm-queue-item-name { font-size: var(--text-sm); color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-queue-item-status { font-size: 0.75rem; color: var(--gray-500); margin-top: 2px; }
.fm-queue-item-status.error { color: var(--destructive); }
.fm-queue-item-status.done { color: var(--green-600); }
.fm-queue-item-status.waiting { color: #ff9800; }
.fm-queue-progress-wrap { width: 100%; height: 4px; background: var(--gray-200); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.fm-queue-progress-bar { height: 100%; background: var(--blue-500); border-radius: 4px; width: 0%; transition: width 0.15s ease; }
.fm-queue-progress-bar.done { background: var(--green-500); }
.fm-queue-progress-bar.error { background: var(--destructive); }

/* ===== 全局上传进度条（下载/上传时的浮动条） ===== */
.fm-global-progress { position: fixed; bottom: 24px; right: 24px; width: 360px; background: var(--card); border-radius: var(--radius-lg); box-shadow: 0 4px 20px rgba(0,0,0,0.18); z-index: 10001; padding: 16px 20px; display: none; animation: fmSlideUp 0.25s ease; }
@keyframes fmSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fm-global-progress.show { display: block; }
.fm-gp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fm-gp-title { font-size: var(--text-sm); font-weight: 600; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.fm-gp-percent { font-size: var(--text-xs); color: var(--blue-600); font-weight: 600; margin-left: 12px; flex-shrink: 0; }
.fm-gp-bar-wrap { width: 100%; height: 6px; background: var(--gray-200); border-radius: 6px; overflow: hidden; }
.fm-gp-bar { height: 100%; background: linear-gradient(90deg, #2196F3, #42a5f5); border-radius: 6px; width: 0%; transition: width 0.15s ease; }
.fm-gp-bar.done { background: linear-gradient(90deg, #4caf50, #66bb6a); }
.fm-gp-info { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.72rem; color: var(--gray-500); }

/* ===== 拖放上传区 ===== */
.fm-drop-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(33, 150, 243, 0.06); border: 3px dashed #2196F3; border-radius: var(--radius-lg); z-index: 500; display: none; align-items: center; justify-content: center; pointer-events: none; }
.fm-drop-overlay.show { display: flex; }
.fm-drop-overlay-inner { text-align: center; }
.fm-drop-overlay-inner .icon { font-size: 3rem; display: block; margin-bottom: 8px; }
.fm-drop-overlay-inner .text { font-size: var(--text-base); color: var(--blue-600); font-weight: 600; }
.fm-drop-overlay-inner .sub { font-size: var(--text-sm); color: var(--gray-500); margin-top: 4px; }
.fm-main { position: relative; } /* for drop overlay positioning */

/* ===== 上传按钮区多文件提示 ===== */
.fm-upload-hint { font-size: 0.72rem; color: var(--gray-400); margin-left: 8px; align-self: center; }

/* --- 6.15 Image Preview --- */
.image-preview-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); cursor: pointer; }
.image-preview-wrapper { position: relative; display: flex; flex-direction: column; align-items: center; z-index: 1; animation: imagePreviewFadeIn 0.2s ease; }
.image-preview-toolbar { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, 0.6); border-radius: 24px; padding: 6px 16px; margin-bottom: 10px; backdrop-filter: blur(8px); }
.img-zoom-btn { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; font-size: 18px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; line-height: 1; }
.img-zoom-btn:hover { background: rgba(255, 255, 255, 0.3); }
.img-zoom-level { color: #fff; font-size: 13px; min-width: 48px; text-align: center; user-select: none; }
.img-zoom-close { background: rgba(255, 80, 80, 0.7) !important; border-color: rgba(255, 80, 80, 0.9) !important; margin-left: 8px; }
.img-zoom-close:hover { background: rgba(255, 80, 80, 0.9) !important; }
.image-preview-viewport { width: 90vw; height: 82vh; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: var(--radius-lg); cursor: grab; }
.image-preview-viewport.dragging { cursor: grabbing; }
.image-preview-viewport img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-lg); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); transition: transform 0.15s ease; user-select: none; -webkit-user-drag: none; }
@keyframes imagePreviewFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ===== Step 7: Responsive + Animations ===== */
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }

@media (max-width: 768px) {
  .document-row { flex-direction: column; }
  .menu { flex-direction: column; }
  .password-form { width: 90%; }
  .homepage-container, .documents-container, .hz-page, .req-page, .ai-page { padding-left: 16px; padding-right: 16px; }
  .myblog-layout { flex-direction: column; }
  .myblog-sidebar { width: 100%; min-width: 100%; position: static; max-height: none; }
  .main-content { flex-direction: column; }
  .table-of-contents { width: 100%; min-width: 100%; position: static; max-height: none; }
  .req-detail-layout { flex-direction: column; }
  .req-detail-sidebar { width: 100%; min-width: 100%; }
  .fm-layout { flex-direction: column; }
  .fm-sidebar { width: 100%; min-width: 100%; position: static; max-height: none; }
  .header > .menu { margin-left: 0; flex-wrap: nowrap; overflow-x: auto; }
  .req-toolbar { flex-direction: column; align-items: stretch; }
  .req-search-wrap { max-width: 100%; }
  .log-filter-row { flex-wrap: wrap; }
  .log-filter-input, .log-filter-keyword { width: 100%; }
  .log-filter-select { width: auto; min-width: 100px; }
  .log-filter-datetime { width: 100%; }
}

/* ===== 邮件提醒模块样式 ===== */
.email-page { max-width: 1200px; width: 100%; margin: 0 auto; padding: 20px; padding-top: 80px; box-sizing: border-box; }
.email-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--gray-200); background: var(--card); border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
.email-tab { padding: 12px 24px; border: none; background: transparent; font-size: var(--text-sm); color: var(--gray-600); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition-colors); font-weight: 500; font-family: inherit; }
.email-tab:hover { color: var(--blue-600); background: var(--blue-50); }
.email-tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); font-weight: 600; }
.email-tab-content { display: none; }
.email-tab-content:first-child { display: block; }
.email-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.email-table thead { background: var(--gray-100); }
.email-table th { padding: 12px 14px; text-align: left; color: var(--gray-600); font-weight: 600; border-bottom: 2px solid var(--muted); white-space: nowrap; }
.email-table td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; color: var(--foreground); }
.email-table tbody tr:hover { background: var(--blue-50); }
.email-table tbody tr:last-child td { border-bottom: none; }
.email-table .empty-row { text-align: center; color: var(--gray-400); padding: 40px 14px; }
.section-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-title { font-size: var(--text-base); font-weight: 600; color: var(--foreground); }
.section-bar .btn-primary { border-radius: 6px; padding: 8px 18px; font-size: var(--text-sm); font-family: inherit; cursor: pointer; border: none; }
.status-tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 500; }
.status-tag.active { background: #e8f5e9; color: #2e7d32; }
.status-tag.inactive { background: #fce4ec; color: #c62828; }
.action-cell { white-space: nowrap; }
.btn-small { padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); font-size: 0.8rem; color: var(--gray-600); cursor: pointer; margin-right: 4px; font-family: inherit; transition: var(--transition-colors); }
.btn-small:hover { background: var(--blue-50); border-color: var(--blue-300); }
.btn-small.btn-danger { color: var(--destructive); border-color: var(--destructive); }
.btn-small.btn-danger:hover { background: #ffebee; }
.btn-cancel { padding: 8px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; font-size: var(--text-sm); color: var(--gray-600); font-family: inherit; }
.btn-confirm { padding: 8px 20px; border: none; border-radius: var(--radius-sm); background: var(--blue-600); color: #fff; cursor: pointer; font-size: var(--text-sm); font-family: inherit; }
.btn-confirm:hover { background: var(--blue-700); }
.pagination { display: flex; justify-content: center; gap: 6px; padding: 16px 0; }
.page-btn { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); font-size: var(--text-sm); color: var(--gray-600); cursor: pointer; font-family: inherit; }
.page-btn.active { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.page-btn:hover:not(.active) { background: var(--gray-100); }

/* 弹窗内两列布局优化 */
.modal-box .flex-row > div { min-width: 0; }
.modal-box .flex-row label { white-space: nowrap; flex-shrink: 0; line-height: 1.5; padding: 2px 0; }
.modal-box .flex-row select { min-width: 0; width: 100%; box-sizing: border-box; }

/* 弹窗样式 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 2000; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 10px; padding: 28px 32px; width: 500px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,0.18); }
.modal-box-wide { width: 800px; }
.modal-box h3 { font-size: 1.1rem; color: #333; margin-bottom: 16px; border-bottom: 1px solid #eee; padding-bottom: 12px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: var(--text-sm); color: var(--gray-600); margin-bottom: 6px; font-weight: 600; }
.form-row input[type="text"], .form-row input[type="email"], .form-row input[type="number"], .form-row input[type="password"], .form-row select { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--foreground); font-family: inherit; background: var(--card); box-sizing: border-box; line-height: 1.5; height: auto; min-height: 40px; }
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.form-row input[type="checkbox"] { margin-right: 6px; }
.form-row .required { color: #e53935; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee; }
.required { color: #e53935; }

/* ==================== 数据同步模块样式 ==================== */
.sync-container { max-width: 1400px; width: 100%; margin: 0 auto; padding: 68px 20px 20px; box-sizing: border-box; }
.sync-container h2 { font-size: 18px; color: var(--foreground, #111827); margin: 0 0 16px 0; }
.sync-sub-nav { display: flex; gap: 0; background: #f3f4f6; border-radius: 8px; padding: 3px; margin-bottom: 20px; }
.sync-sub-nav a { padding: 7px 18px; border-radius: 6px; text-decoration: none; font-size: 13px; color: #6b7280; transition: all 0.15s; white-space: nowrap; }
.sync-sub-nav a.active { background: #fff; color: var(--foreground, #111827); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.sync-sub-nav a:hover:not(.active) { color: #374151; background: rgba(0,0,0,0.03); }
.sync-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 20px; background: #fff; }
.sync-card h3 { margin: 0 0 16px; font-size: 16px; color: var(--foreground, #111827); }
.sql-editor { width: 100%; min-height: 180px; font-family: 'Consolas','Courier New',monospace; font-size: 13px; padding: 14px; border: 1px solid #d1d5db; border-radius: 8px; resize: vertical; background: #1e1e2e; color: #cdd6f4; line-height: 1.6; box-sizing: border-box; }
.sql-editor:focus { outline: none; border-color: var(--blue-600, #2563eb); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.query-toolbar { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.result-panel { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin-top: 16px; background: #fff; }
.result-header { padding: 12px 16px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.result-table-wrap { overflow-x: auto; }
.result-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.result-table th { background: #f3f4f6; padding: 10px 14px; text-align: left; font-weight: 600; color: #374151; border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
.result-table td { padding: 8px 14px; border-bottom: 1px solid #f3f4f6; color: #4b5563; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-table tr:hover td { background: #f9fafb; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: #f9fafb; padding: 12px 14px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid #e5e7eb; white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; color: #4b5563; }
.data-table tr:hover td { background: #f9fafb; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.status-badge.pending { background: #f3f4f6; color: #6b7280; }
.status-badge.running { background: #dbeafe; color: #1e40af; }
.status-badge.completed { background: #d1fae5; color: #065f46; }
.status-badge.failed { background: #fee2e2; color: #991b1b; }
.status-badge.synced { background: #d1fae5; color: #065f46; }
.status-badge.pending_upload { background: #fef3c7; color: #92400e; }
.status-badge.uploading { background: #dbeafe; color: #1e40af; }
.sync-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; }
.sync-overlay.show { display: flex; }
.sync-modal { background: #fff; border-radius: 10px; padding: 24px; width: 500px; max-width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,0.15); }
.sync-modal h3 { margin: 0 0 16px; font-size: 16px; color: var(--foreground, #111827); }
.sync-modal-wide { width: 800px; }
.sync-pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 20px; }
.sync-pagination button { padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; color: #374151; }
.sync-pagination button:hover { background: #f3f4f6; }
.sync-pagination button:disabled { opacity: 0.5; cursor: default; }
.sync-pagination span { font-size: 13px; color: #6b7280; }
.sync-empty { text-align: center; padding: 60px 20px; color: #9ca3af; }
.sync-empty p { font-size: 14px; margin: 8px 0; }
@media(max-width:768px) { .sync-container { padding: 12px; } .sync-sub-nav { overflow-x: auto; } }
