:root {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1f2933;
  background-color: #f4f6f8;

  --col-task-no: 70px;   /* 课题编号 */
  --col-title: 240px;     /* 标题 */
  --col-priority: 60px;   /* 优先级 */
  --col-due-date: 90px;  /* 处理期限 */
  --col-status: 80px;    /* 处理分类 */
  --col-logs: 600px;      /* 处理记录 */
  --col-attachments: 85px; /* 附件 */
  /* 总宽度：70+240+60+90+80+600+200 = 1340px，适配1920px屏幕 */
}

body {
  margin: 0;
  line-height: 1.5;
  background-color: #f4f6f8;
}

.header {
  background-color: #1c64f2;
  color: #fff;
  padding: 0.75rem 2rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.header-left h1 {
  margin: 0;
  font-size: 1.35rem;
}

.header-subtitle {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.9;
}

.nav {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
  align-items: center;
}

.nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav span {
  font-weight: 500;
}

.nav-user {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.user-info-clickable {
  cursor: pointer;
  transition: opacity 0.2s ease;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.user-info-clickable:hover {
  opacity: 0.8;
  background-color: rgba(255, 255, 255, 0.1);
}

.header-date {
  font-size: 0.8rem;
  opacity: 0.85;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  margin-left: 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background-color: rgba(251, 191, 36, 0.2);
  color: #92400e;
  border: 1px solid rgba(251, 191, 36, 0.7);
}

.container {
  width: 100%;

  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
  box-sizing: border-box;
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  margin-bottom: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 0.35rem;
}

input,
select,
textarea {
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
}

.full-width {
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
}

button {
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  background-color: #334155;
  color: #fff;
  justify-self: start;
}

button.primary {
  background-color: #1c64f2;
}

.task-grid {
  display: grid;
  gap: 1rem;
}

.table-wrapper {
  overflow-x: auto;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
}

.task-table th,
.task-table td {
  border: 1px solid #e2e8f0;
  padding: 0.6rem;
  vertical-align: top;
  text-align: center;
  word-wrap: break-word;
  word-break: break-all;
}

.task-table thead {
  background-color: #f8fafc;
  font-weight: 600;
}

.task-table tbody tr:nth-child(odd) {
  background-color: #fff;
}

.task-table tbody tr:hover {
  background-color: #eff6ff;
}

.task-table tbody tr.row-critical {
  background-color: #fef2f2;
}

.task-table tbody tr.row-critical:hover {
  background-color: #fee2e2;
}

.task-table tbody tr.row-done {
  background-color: #e5e7eb;
}

.task-table tbody tr.row-done:hover {
  background-color: #d4d4d8;
}
/* 列宽统一通过 colgroup 控制，值来自顶部 CSS 变量 */
.task-table col.col-task-no {
  width: var(--col-task-no);
}
.task-table col.col-title {
  width: var(--col-title);
}
.task-table col.col-priority {
  width: var(--col-priority);
}
.task-table col.col-date {
  width: var(--col-due-date);
}
.task-table col.col-status {
  width: var(--col-status);
}
.task-table col.col-logs {
  width: var(--col-logs);
}
.task-table col.col-attachments {
  width: var(--col-attachments);
}

/* 单元格自己的行为，仅处理对齐和文本，不再设置 width */
.cell-task-no {
  white-space: nowrap;
}

.task-edit-btn {
  display: none;
  margin-top: 0.25rem;
  margin-left: 0;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.02);
  color: #475569;
}

td.cell-task-no:hover .task-edit-btn {
  display: inline-flex;
}

.task-no-content {
  display: flex;
  flex-direction: column;
  align-items: center; /* 课题编号及"编辑"按钮水平居中 */
}

.task-table td.cell-title {
  text-align: left;
}

.cell-priority,
.cell-status {
  text-align: center;
  cursor: pointer;
}

/* .cell-status-done 使用默认字体颜色，无需特殊样式 */

.cell-logs {
  text-align: left;
}

.cell-attachments {
  text-align: left;
  font-size: 0.85rem;
}

.editable-category,
.editable-date {
  cursor: pointer;
}

.editable-category select {
  width: 100%;
  border-radius: 4px;
  padding: 0.3rem;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.log-list li {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.4rem;
  padding: 0.2rem 0.4rem;
  padding-right: 80px; /* 为按钮预留空间 */
  border-radius: 4px;
  background-color: transparent; /* 具体颜色由下面的 nth-child 控制 */
  font-size: 0.8rem;
  position: relative;
}

.log-detail {
  white-space: normal;
  word-break: break-all;
  text-align: left;
  display: inline-block;
  flex: 1;
}

.log-date {
  display: inline-block;
  min-width: 80px;
  text-align: center;
}

.log-list li:nth-child(3n + 1) {
  background-color: #e0f2fe; /* 浅蓝 */
}

.log-list li:nth-child(3n + 2) {
  background-color: #dcfce7; /* 浅绿 */
}

.log-list li:nth-child(3n + 3) {
  background-color: #fef9c3; /* 浅黄 */
}

.log-edit-btn {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  margin: 0;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.02);
  color: #475569;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1;
  white-space: nowrap;
  cursor: pointer;
}

.log-list li:hover .log-edit-btn {
  opacity: 1;
  visibility: visible;
}

.log-delete-btn {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  margin: 0;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid rgba(248, 113, 113, 0.8);
  background: rgba(248, 113, 113, 0.06);
  color: #b91c1c;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1;
  white-space: nowrap;
  cursor: pointer;
}

.log-list li:hover .log-delete-btn {
  opacity: 1;
  visibility: visible;
}

.log-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.log-add-btn {
  align-self: flex-start;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 999px;
}

.log-form-table {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.log-form-table textarea {
  resize: vertical;
}

/* 附件相关样式 */
.attachments-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background-color: #f3f4f6;
  font-size: 0.8rem;
  transition: background-color 0.2s;
}

.attachment-item:hover {
  background-color: #e5e7eb;
}

.attachment-link {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  text-decoration: none;
  color: #374151;
  overflow: hidden;
}

.attachment-link:hover {
  color: #3b82f6;
}

.attachment-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.attachment-delete-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.attachment-delete-btn:hover {
  background-color: #fee2e2;
}

.attachment-add-btn {
  align-self: flex-start;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  border-radius: 4px;
}

/* 附件按钮优化 */
.attachment-upload-btn {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.8125rem !important;
  line-height: 1.4 !important;
  border-radius: 6px !important;
  background: #eff6ff !important;
  border: 1px solid #3b82f6 !important;
  color: #2563eb !important;
  font-weight: 500 !important;
  transition: all 0.2s ease;
  display: inline-flex !important;
  align-items: center;
  gap: 0.375rem;
}

.attachment-upload-btn:hover {
  background: #dbeafe !important;
  border-color: #2563eb !important;
  color: #1d4ed8 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.attachment-view-btn {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.8125rem !important;
  line-height: 1.4 !important;
  border-radius: 6px !important;
  background: #f0fdf4 !important;
  border: 1px solid #22c55e !important;
  color: #16a34a !important;
  font-weight: 500 !important;
  transition: all 0.2s ease;
  display: inline-flex !important;
  align-items: center;
  gap: 0.375rem;
}

.attachment-view-btn:hover {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #15803d !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

/* 附件网格布局 */
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.attachment-grid-item {
  display: flex;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}

.attachment-grid-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.attachment-thumbnail {
  position: relative;
  width: 100%;
  height: 120px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.attachment-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.attachment-thumbnail.attachment-video,
.attachment-thumbnail.attachment-file {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.attachment-video-icon,
.attachment-file-icon {
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.9);
}

.attachment-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.attachment-preview-btn,
.attachment-download-btn,
.attachment-delete-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  color: #374151;
  min-width: 2rem;
  height: 2rem;
}

.attachment-preview-btn:hover,
.attachment-download-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

.attachment-delete-btn {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.attachment-delete-btn:hover {
  background: #fecaca;
  border-color: #f87171;
  color: #b91c1c;
  transform: translateY(-1px);
}

.attachment-info {
  padding: 0.5rem;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
}

.attachment-name {
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.25rem;
}

.attachment-meta {
  font-size: 0.7rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.attachments-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: #6b7280;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-text {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #374151;
}

.empty-hint {
  font-size: 0.85rem;
  color: #9ca3af;
}

.attachments-empty-redesign {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  min-height: 200px;
}

.empty-icon-redesign {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-text-redesign {
  font-size: 1rem;
  color: #6b7280;
}

/* 现代化附件管理模态框样式 */
.attachments-modal-content-modern {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* 重新设计的附件管理样式 */
.attachments-modal-redesign {
  background: #fff;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 简洁头部 */
.attachments-header-redesign {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.attachments-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.attachments-title-redesign {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.attachments-count-redesign {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: #3b82f6;
  color: #fff;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.attachments-count-text {
  font-size: 0.875rem;
  color: #6b7280;
}

.attachments-close-redesign {
  min-width: auto;
  width: auto;
  height: 36px;
  padding: 0 12px;
  background: #fee2e2;
  border: 2px solid #fca5a5;
  color: #dc2626;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  flex-shrink: 0;
  margin-left: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.attachments-close-redesign svg {
  width: 16px;
  height: 16px;
  stroke: #dc2626;
  stroke-width: 2.5;
  fill: none;
  flex-shrink: 0;
}

.attachments-close-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: #dc2626;
  line-height: 1;
}

/* 上传区域 */
.attachment-upload-area {
  margin-bottom: 1.5rem;
}

.upload-dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-dropzone:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.upload-dropzone.drag-over {
  border-color: #3b82f6;
  background: #dbeafe;
  transform: scale(1.02);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.upload-text {
  font-size: 1rem;
  color: #374151;
  margin-bottom: 0.5rem;
}

.upload-link {
  color: #3b82f6;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}

.upload-link:hover {
  color: #2563eb;
}

.upload-hint {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

.upload-progress {
  margin-top: 1rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
}

/* 附件列表容器 */
.attachments-list-container {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
  max-height: 400px;
}

.attachments-container-redesign {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f9fafb;
  min-height: 300px;
  width: 100%;
  position: relative;
}

.attachments-grid-redesign {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1rem;
  width: 100%;
}

/* 响应式：小屏幕自适应 */
@media (max-width: 1200px) {
  .attachments-grid-modern {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .attachments-grid-modern {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .attachments-grid-modern {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 网格视图样式 - 一行3个 */
.attachment-list-row {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

.attachment-list-row:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* 保留旧样式以兼容 */
.attachment-list-item {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
  cursor: default;
}

.attachment-list-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 网格预览区域 */
.attachment-list-preview {
  width: 100%;
  height: 180px;
  flex-shrink: 0;
  border-radius: 0;
  overflow: hidden;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.attachment-list-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.attachment-list-row:hover .attachment-list-preview img {
  transform: scale(1.05);
}

.attachment-list-preview-icon {
  background: #f3f4f6;
}

.attachment-list-icon {
  font-size: 3rem;
  color: #9ca3af;
}

/* 视频预览缩略图 */
.attachment-list-video-preview {
  position: relative;
  overflow: hidden;
}

.attachment-video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  pointer-events: none;
}

.attachment-video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transition: background 0.2s;
}

.attachment-list-row:hover .attachment-video-overlay {
  background: rgba(0, 0, 0, 0.2);
}

.attachment-video-play-icon {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s;
}

.attachment-list-row:hover .attachment-video-play-icon {
  transform: scale(1.1);
}

/* 当视频缩略图加载后，显示视频并隐藏图标 */
.attachment-list-video-preview:has(video[style*="display: block"]) .attachment-list-icon {
  display: none;
}

.attachment-list-video-preview video[style*="display: block"] {
  display: block !important;
}

/* 网格详情区域 */
.attachment-list-details {
  flex: 1;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.attachment-list-name-row {
  cursor: pointer;
}

.attachment-list-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.attachment-list-name-row:hover .attachment-list-name {
  color: #3b82f6;
}

.attachment-list-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.attachment-list-separator {
  color: #d1d5db;
}

/* 网格操作按钮 */
.attachment-list-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #f3f4f6;
  background: #fafbfc;
}

.attachment-list-btn {
  flex: 1;
  height: 32px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #6b7280;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.attachment-list-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
}

.attachment-list-btn-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* 图片缩略图优化 - 确保图片清晰可见 */
.attachment-list-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.attachment-list-thumbnail::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.05) 100%);
  pointer-events: none;
}

.attachment-list-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.attachment-list-item:hover .attachment-list-thumbnail img {
  transform: scale(1.08);
}

.attachment-list-thumbnail.attachment-video,
.attachment-list-thumbnail.attachment-file {
  background: #f3f4f6;
}

.attachment-list-thumbnail .attachment-video-icon,
.attachment-list-thumbnail .attachment-file-icon {
  font-size: 2.5rem;
  color: #9ca3af;
}

/* 保留兼容性样式 */
.attachment-info-redesign {
  display: none;
}

/* 可点击的卡片样式 */
.attachment-item-image,
.attachment-item-video,
.attachment-item-file {
  cursor: pointer;
}

.attachments-modal-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

/* 移除底部，使用头部关闭按钮 */

/* 预览模态框样式 - 旧版本（保留兼容） */
.preview-modal-content {
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
}

.preview-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.preview-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.preview-modal-close:active {
  transform: scale(0.95);
}

.preview-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.preview-control-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  min-width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.preview-control-btn:active {
  transform: scale(0.95);
}

.preview-content-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.preview-content-wrapper img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.preview-content-wrapper:fullscreen {
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-content-wrapper:fullscreen img {
  max-height: 100vh;
}

/* 新预览模态框样式 */
.preview-modal-new {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.preview-modal-new[aria-hidden="false"] {
  display: flex;
  opacity: 1;
}

.preview-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
}

.preview-modal-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

/* 顶部工具栏 */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.preview-toolbar-left {
  flex: 1;
  min-width: 0;
}

.preview-filename {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.preview-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.preview-toolbar-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
}

.preview-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.preview-toolbar-btn:active {
  transform: translateY(0);
}

.preview-toolbar-btn .icon {
  font-size: 1rem;
  line-height: 1;
}

.preview-close-btn {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

.preview-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
}

/* 预览内容区域 */
.preview-content-new {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 2rem;
  position: relative;
}

.preview-content-new img {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  cursor: move;
  user-select: none;
  transition: transform 0.1s;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.preview-content-new video {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* 底部信息栏 */
.preview-footer {
  padding: 0.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
}

.preview-separator {
  color: rgba(255, 255, 255, 0.3);
}

/* 全屏模式 */
.preview-content-new:fullscreen {
  background: rgba(0, 0, 0, 0.95);
  padding: 0;
}

.preview-content-new:fullscreen img {
  max-height: 100vh;
}

.task-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  background: #fdfdfd;
}

.task-card header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #475569;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  margin-left: 0.4rem;
}

.badge.status {
  background-color: #f1f5f9;
}

.priority-1 {
  background-color: #fee2e2;
  color: #b91c1c;
}

.priority-0 {
  background-color: #dcfce7;
  color: #15803d;
}

.logs ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.logs li {
  display: flex;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #edf2f7;
}

.logs time {
  font-weight: 600;
}

.log-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 0.8rem;
}

/* 顶部右侧浮动提示 */
.flash-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1100;
}

.flash {
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
  min-width: 180px;
}

.flash.success {
  background-color: #dcfce7;
  color: #14532d;
}

.flash.error {
  background-color: #fee2e2;
  color: #991b1b;
}

/* 闪消息淡出动画 */
.flash-list.flash-hide {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.muted {
  color: #94a3b8;
}

.stats-card {
  margin-bottom: 1rem;
  padding-top: 0.1rem;  /* 减少标题上方留白 */
  padding-bottom: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.stat-item {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
}

.stat-label {
  font-size: 0.8rem;
  color: #6b7280;
}

.stat-value {
  margin-top: 0.2rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
}

.stat-value.clickable-stat {
  cursor: pointer;
  transition: color 0.2s, text-decoration 0.2s;
}

.stat-value.clickable-stat:hover {
  color: #3b82f6;
  text-decoration: underline;
}

.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper input[type="text"] {
  padding-right: 2rem;
  min-width: 340px; /* 让提示文字完整显示 */
  width: 100%;
}

.search-clear-btn {
  position: absolute;
  right: 0.4rem;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 1rem;
  padding: 0;
  cursor: pointer;
}

.search-clear-btn:hover {
  color: #4b5563;
}

.ghost {
  background-color: transparent;
  color: #1f2933;
  border: 1px solid #cbd5f5;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1001;
  width: min(640px, 90vw);
}

.modal.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* 附件管理模态框 - 实体弹窗样式 */
#attachments-modal {
  width: min(1200px, 95vw);
  transform: translate(-50%, -50%);
  transition: opacity 0.15s ease;
}

#attachments-modal.visible {
  transform: translate(-50%, -50%);
}

.modal-content {
  background: #fff;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
  position: relative;
}

/* 上传成功提示弹窗样式 */
#upload-success-modal {
  width: min(400px, 90vw);
}

#upload-success-modal .modal-content {
  padding: 2rem;
}

#upload-success-modal h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #16a34a;
}

#upload-success-message {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #374151;
  margin: 0 0 1.5rem 0;
  white-space: pre-line;
  word-break: break-word;
}

#upload-success-confirm {
  min-width: 100px;
  padding: 0.5rem 1.5rem;
}

/* 文件格式确认弹窗样式 */
#file-format-confirm-modal {
  width: min(450px, 90vw);
}

#file-format-confirm-modal .modal-content {
  padding: 2rem;
}

#file-format-confirm-modal h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #dc2626;
}

#file-format-message {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #374151;
  margin: 0 0 1rem 0;
  white-space: pre-line;
  word-break: break-word;
}

/* 通用弹窗样式 */
#custom-alert-modal,
#custom-confirm-modal {
  width: min(450px, 90vw);
  z-index: 10002 !important;
}

#custom-alert-modal {
  z-index: 10002 !important;
}

/* 确保确认和提示弹窗的背景遮罩也在最上层 */
.modal-backdrop[data-active-modal="custom-confirm-modal"],
.modal-backdrop[data-active-modal="custom-alert-modal"] {
  z-index: 10001 !important;
}

#custom-alert-modal .modal-content,
#custom-confirm-modal .modal-content {
  padding: 2rem;
}

#custom-alert-title,
#custom-confirm-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

#custom-alert-message,
#custom-confirm-message {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #374151;
  margin: 0 0 1.5rem 0;
  white-space: pre-line;
  word-break: break-word;
}

#custom-alert-confirm,
#custom-confirm-ok,
#custom-confirm-cancel {
  min-width: 80px;
  padding: 0.5rem 1.5rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  color: #475569;
  font-size: 1.4rem;
  line-height: 1;
  border: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* 附件管理模态框背景 - 实体弹窗样式，减少背景遮罩 */
.modal-backdrop[data-active-modal="attachments-modal"] {
  background: rgba(15, 23, 42, 0.15) !important;
}

/* === 课题列表列宽优先级修正（放在样式文件靠后，覆盖前面规则） === */

/* 固定 5 个窄列：课题编号 / 优先级 / 登记者 / 处理期限 / 处理分类，使用顶部 CSS 变量 */
.task-table td.cell-task-no {
  width: var(--col-task-no) !important;
}
.task-table td.cell-priority {
  width: var(--col-priority) !important;
}
.task-table td.cell-date {
  width: var(--col-due-date) !important;
}
.task-table td.cell-status {
  width: var(--col-status) !important;
}

/* 标题、处理记录使用剩余空间 */
.task-table td.cell-title {
  width: var(--col-title) !important;
}
.task-table td.cell-logs {
  width: var(--col-logs) !important;
}

/* CSV导入导出按钮样式 */
.csv-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.csv-import-form {
  margin: 0;
  display: inline-block;
}

.csv-export-btn,
.csv-import-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin: 0;
  box-sizing: border-box;
  /* 重置 label 的默认样式 */
  flex-direction: row !important;
  font-family: inherit;
  line-height: 1.5;
}

/* 确保 label 元素不会继承 form-grid 的样式 */
.csv-import-btn {
  display: inline-flex !important;
  flex-direction: row !important;
  margin: 0 !important;
  font-size: 0.875rem !important;
  gap: 0.5rem !important;
}

.csv-export-btn:hover,
.csv-import-btn:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.csv-export-btn:active,
.csv-import-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.csv-export-btn span,
.csv-import-btn span {
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.csv-import-btn input[type="file"] {
  display: none;
}

/* Summernote 富文本编辑器样式 */
#detail-editor {
  margin-top: 0.25rem;
}

.note-editor {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: visible;
}

.note-toolbar {
  background-color: #f9fafb;
  border-bottom: 1px solid #d1d5db;
  padding: 0.5rem;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  position: relative;
}

.note-editable {
  min-height: 150px;
  padding: 0.75rem;
  font-size: 0.875rem;
}

.note-editable:empty:before {
  color: #9ca3af;
  content: attr(placeholder);
}

.note-btn-group {
  position: relative;
  display: inline-block;
}

.note-btn-group button {
  border-color: #d1d5db;
}

.note-btn-group button:hover {
  background-color: #e5e7eb;
}

/* Summernote 下拉菜单样式 */
.note-dropdown-menu {
  z-index: 10002 !important;
  max-height: 400px;
  overflow-y: auto;
  position: absolute !important;
}

/* 确保 Summernote 下拉菜单在模态框中正常显示 */
.modal .note-dropdown-menu {
  z-index: 10002 !important;
  position: absolute !important;
  max-height: 400px;
  overflow-y: auto;
}

/* 确保模态框内容可以滚动，以便显示完整内容 */
#log-modal .modal-content {
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: visible;
}

/* 确保 Summernote 编辑器容器可以显示完整内容 */
.modal .note-editor {
  overflow: visible !important;
}

.modal .note-editing-area {
  overflow: visible !important;
}

/* 确保颜色选择器面板完整显示 */
.note-color-palette {
  max-height: 300px;
  overflow-y: auto;
}

.note-color-palette .note-color-row {
  display: flex;
  flex-wrap: wrap;
}

/* 富文本内容显示样式 */
.log-detail {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.log-detail p {
  margin: 0.5rem 0;
}

.log-detail p:first-child {
  margin-top: 0;
}

.log-detail p:last-child {
  margin-bottom: 0;
}

/* 当最后一个段落后面有记录者名字时，让它们在同一行 */
.log-detail p:last-child + .log-author {
  margin-left: 0.3rem;
}

.log-detail ul,
.log-detail ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.log-detail h1,
.log-detail h2,
.log-detail h3 {
  margin: 0.75rem 0 0.5rem 0;
  font-weight: 600;
}

.log-detail h1 {
  font-size: 1.5rem;
}

.log-detail h2 {
  font-size: 1.25rem;
}

.log-detail h3 {
  font-size: 1.125rem;
}

.log-detail a {
  color: #3b82f6;
  text-decoration: underline;
}

.log-detail a:hover {
  color: #2563eb;
}

.log-detail strong {
  font-weight: 600;
}

.log-detail em {
  font-style: italic;
}

.log-detail u {
  text-decoration: underline;
}

.log-detail s {
  text-decoration: line-through;
}

.log-author {
  display: inline;
  white-space: nowrap;
  margin-left: 0.3rem;
}

