/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #22A06B;
  --primary-light: #E8F7EF;
  --primary-dark: #1A7D54;
  --bg: #F5F6FA;
  --card-bg: #FFFFFF;
  --text: #1A1D29;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F0F1F5;
  --green: #22C55E;
  --green-light: #DCFCE7;
  --orange: #F59E0B;
  --orange-light: #FEF3C7;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --blue: #3B82F6;
  --blue-light: #DBEAFE;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E8F7EF 0%, #D4F0E0 100%);
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  text-align: center;
}

.login-logo {
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-form {
  text-align: left;
}

.login-error {
  background: var(--red-light);
  color: var(--red);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.login-hint {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.8;
  text-align: left;
}

/* ===== 表单组件 ===== */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.required { color: var(--red); }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,107,237,0.1);
}

.form-group textarea {
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* ===== 按钮 ===== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--border-light);
  color: var(--text-secondary);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #E2E5EB;
}

.btn-full {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

/* ===== 主应用布局 ===== */
.app-page {
  min-height: 100vh;
}

.app-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
}

.user-dept {
  font-size: 12px;
  color: var(--text-light);
  background: var(--border-light);
  padding: 3px 10px;
  border-radius: 12px;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ===== 标签页 ===== */
.tab-nav {
  display: flex;
  gap: 0;
  padding: 0 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20px;
  right: 20px;
  height: 2.5px;
  background: var(--primary);
  border-radius: 2px;
}

.tab-content {
  display: none;
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.tab-content.active {
  display: block;
}

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: flex;
  gap: 10px;
}

.select-filter {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--card-bg);
  cursor: pointer;
  outline: none;
}

.select-filter:focus {
  border-color: var(--primary);
}

/* ===== 任务卡片 ===== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s, transform 0.1s;
  cursor: pointer;
}

.task-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.task-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-light);
}

.task-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.badge-pending { background: var(--border-light); color: var(--text-secondary); }
.badge-in_progress { background: var(--blue-light); color: var(--blue); }
.badge-completed { background: var(--green-light); color: var(--green); }

.badge-low { background: var(--border-light); color: var(--text-secondary); }
.badge-normal { background: var(--blue-light); color: var(--blue); }
.badge-high { background: var(--orange-light); color: var(--orange); }
.badge-urgent { background: var(--red-light); color: var(--red); }

.badge-overdue {
  background: var(--red-light);
  color: var(--red);
  animation: pulse 2s infinite;
}

.badge-shared {
  background: #E8F5E9;
  color: #2E7D32;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.task-meta {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.task-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.task-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-0 { background: var(--border); }
.progress-1-33 { background: var(--red); }
.progress-34-66 { background: var(--orange); }
.progress-67-99 { background: var(--blue); }
.progress-100 { background: var(--green); }

.task-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.task-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state p {
  margin-top: 12px;
  font-size: 15px;
}

/* ===== 管理看板 ===== */
.dashboard-header {
  margin-bottom: 24px;
}

.dashboard-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.dashboard-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.dashboard-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dashboard-card-name {
  font-size: 15px;
  font-weight: 700;
}

.dashboard-card-dept {
  font-size: 11px;
  color: var(--text-light);
  background: var(--border-light);
  padding: 3px 8px;
  border-radius: 10px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-item {
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.stat-pending .stat-num { color: var(--text-secondary); }
.stat-in_progress .stat-num { color: var(--blue); }
.stat-completed .stat-num { color: var(--green); }
.stat-overdue .stat-num { color: var(--red); }

.dashboard-overall {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.dashboard-overall-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.dashboard-overall-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.dashboard-overall-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal {
  background: var(--card-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-large {
  max-width: 600px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ===== 任务详情弹窗内部样式 ===== */
.detail-section {
  margin-bottom: 20px;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--text);
}

.detail-progress-section {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.detail-progress-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.detail-progress-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-light);
  border-radius: 3px;
  outline: none;
}

.detail-progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.detail-progress-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  min-width: 50px;
  text-align: right;
}

.detail-update-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  margin-top: 10px;
  outline: none;
}

.detail-update-input:focus {
  border-color: var(--primary);
}

.detail-status-select {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.update-history {
  max-height: 200px;
  overflow-y: auto;
}

.update-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.update-item:last-child {
  border-bottom: none;
}

.update-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.update-item-user {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}

.update-item-time {
  font-size: 11px;
  color: var(--text-light);
}

.update-item-content {
  color: var(--text-secondary);
  font-size: 12px;
}

.update-item-progress {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

/* ===== 文件上传区域 ===== */
.detail-file-upload {
  margin-top: 12px;
}

.file-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.file-preview-item {
  position: relative;
  width: 100px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.file-preview-thumb {
  width: 100%;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
}

.file-preview-icon {
  font-size: 28px;
  line-height: 56px;
  text-align: center;
  height: 56px;
}

.file-preview-name {
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.file-preview-remove:hover {
  background: var(--red);
}

.file-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.file-upload-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.file-upload-hint {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 6px;
}

/* ===== 进展记录中的文件附件 ===== */
.update-item-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 4px;
}

.file-attach-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  max-width: 200px;
}

.file-attach-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.file-attach-img {
  padding: 4px;
  flex-direction: column;
  gap: 2px;
}

.file-attach-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.file-attach-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.file-attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 图片查看器（全屏） ===== */
.image-viewer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 30px;
  cursor: zoom-out;
}

.image-viewer-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.image-viewer-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-close:hover {
  background: rgba(255,255,255,0.35);
}

/* ===== 额外可见人员选择 ===== */
.shared-with-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.shared-with-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shared-with-group-label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 2px;
}
.shared-with-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.shared-with-item:hover {
  background: var(--primary-light);
}
.shared-with-item input {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group {
    flex-direction: column;
  }
  .select-filter {
    width: 100%;
  }
  .task-meta {
    flex-direction: column;
    gap: 4px;
  }
}

/* ===== 日历视图 ===== */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0 10px;
  position: relative;
}
.cal-nav-btn {
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.cal-nav-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}
.cal-month-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  min-width: 140px;
  text-align: center;
}
.cal-today-btn {
  position: absolute;
  right: 0;
  border: 1px solid var(--primary);
  background: white;
  color: var(--primary);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.cal-today-btn:hover {
  background: var(--primary);
  color: white;
}

.cal-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-light);
}
.cal-legend-bar {
  display: inline-block;
  width: 16px;
  height: 10px;
  border-radius: 2px;
  border-left: 3px solid transparent;
}

.cal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.cal-dot-overdue { background: #e74c3c; }
.cal-dot-pending { background: #95a5a6; }
.cal-dot-progress { background: #3498db; }
.cal-dot-done { background: #27ae60; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cal-weekdays > div {
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}
.cal-weekdays > div:last-child,
.cal-weekdays > div:nth-child(6) {
  color: #e74c3c;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-top: none;
}
.cal-cell {
  background: white;
  min-height: 108px;
  padding: 4px 4px 3px;
  position: relative;
  cursor: default;
  transition: background 0.1s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cal-cell-other {
  background: #f8f9fa;
}
.cal-cell-other .cal-cell-date {
  color: var(--text-lighter);
}
.cal-cell:not(.cal-cell-other):hover {
  background: #f0faf4;
}
.cal-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.cal-cell-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.cal-cell-today {
  background: #e8f7ef;
}
.cal-cell-today .cal-cell-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
}
.cal-cell-overdue {
  background: #fff5f5;
}
.cal-cell-overdue .cal-cell-date {
  color: #e74c3c;
}
.cal-cell-soon {
  background: #fffdf0;
}
.cal-cell-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.4;
}
.cal-cell-badge-overdue {
  background: #e74c3c;
  color: white;
}

/* 任务条 */
.cal-cell-tasks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}
.cal-task-bar {
  font-size: 11px;
  line-height: 1.3;
  padding: 2px 4px 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.1s;
  border-left: 3px solid transparent;
  background: #f8f9fa;
  color: var(--text);
}
.cal-task-bar:hover {
  opacity: 0.75;
}
.cal-bar-overdue {
  border-left-color: #e74c3c;
  background: #ffe8e8;
  color: #c0392b;
  font-weight: 600;
}
.cal-bar-progress {
  border-left-color: #3498db;
  background: #ebf5fb;
  color: #2471a3;
}
.cal-bar-pending {
  border-left-color: #95a5a6;
  background: #f4f6f7;
  color: #7f8c8d;
}
.cal-bar-done {
  border-left-color: #27ae60;
  background: #eafaf1;
  color: #1e8449;
  text-decoration: line-through;
  opacity: 0.65;
}
.cal-more {
  font-size: 10px;
  color: var(--primary);
  cursor: pointer;
  padding: 1px 4px;
  font-weight: 600;
}

.cal-day-detail {
  margin-top: 12px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.cal-day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border-light);
}
.cal-day-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.cal-day-close {
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}
.cal-day-close:hover {
  color: var(--text);
}

.cal-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}
.cal-task-item:hover {
  background: #f8f9fa;
}
.cal-task-item:last-child {
  border-bottom: none;
}
.cal-task-overdue {
  background: #fff5f5;
}
.cal-task-overdue:hover {
  background: #ffe8e8;
}
.cal-task-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.cal-task-stripe {
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  flex-shrink: 0;
}
.cal-task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-task-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cal-task-assignee {
  font-size: 12px;
  color: var(--text-light);
}
.cal-task-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  min-width: 32px;
  text-align: right;
}

@media (max-width: 600px) {
  .cal-cell {
    min-height: 72px;
    padding: 2px;
  }
  .cal-cell-date {
    font-size: 11px;
  }
  .cal-task-bar {
    font-size: 10px;
    padding: 1px 2px 1px 4px;
  }
  .cal-cell-today .cal-cell-date {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  .cal-cell-badge {
    font-size: 9px;
    padding: 0 3px;
  }
  .cal-today-btn {
    padding: 4px 10px;
    font-size: 12px;
  }
  .cal-month-label {
    font-size: 15px;
    min-width: 100px;
  }
  .cal-legend {
    gap: 8px;
  }
  .cal-task-right {
    gap: 4px;
  }
  .cal-task-assignee {
    display: none;
  }
}

/* ===== 金额badge ===== */
.badge-amount {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  color: #92400E;
  border: 1px solid #FCD34D;
  font-weight: 700;
}

/* ===== 子任务清单 ===== */
.checklist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.checklist-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.checklist-item input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.checklist-content {
  flex: 1;
  min-width: 0;
}
.checklist-title {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.checklist-done .checklist-title {
  text-decoration: line-through;
  color: var(--text-light);
}
.checklist-note {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ===== 报表/汇总 ===== */
.report-header {
  margin-bottom: 20px;
}
.report-header h2 {
  font-size: 20px;
  font-weight: 700;
}
.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.report-toolbar .filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.preset-range {
  padding: 6px 14px;
  font-size: 12px;
}
.report-totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.report-total-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.report-total-completed {
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  border-color: #86EFAC;
}
.report-total-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.report-total-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.report-section {
  margin-bottom: 24px;
}
.report-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.report-table {
  width: 100%;
  background: var(--card-bg);
  border-collapse: collapse;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}
.report-table thead {
  background: var(--bg);
}
.report-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}
.report-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}
.report-table tr:last-child td {
  border-bottom: none;
}
.report-table tr:hover td {
  background: var(--bg);
}

/* ===== 会计专区 ===== */
.finance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.finance-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.finance-income {
  background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
  border-color: #6EE7B7;
}
.finance-expense {
  background: linear-gradient(135deg, #FEF2F2, #FECACA);
  border-color: #FCA5A5;
}
.finance-profit {
  background: var(--card-bg);
  border: 2px solid var(--border);
}
.finance-profit-pos {
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  border-color: #86EFAC;
}
.finance-profit-neg {
  background: linear-gradient(135deg, #FEF2F2, #FECACA);
  border-color: #FCA5A5;
}
.finance-card-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.finance-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.finance-card-sub {
  font-size: 11px;
  color: var(--text-light);
}

/* ===== 新建任务：作业单文档上传区 ===== */
.doc-upload-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.doc-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
  white-space: nowrap;
}

.doc-upload-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.doc-upload-hint {
  font-size: 12px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-parsing-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.doc-parsing-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 解析出的作业节点预览 ===== */
.parsed-checklist-preview {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.parsed-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
}

.parsed-checklist-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  padding: 2px 8px;
  background: var(--bg);
  border-radius: 10px;
}

.parsed-checklist-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.parsed-checklist-list {
  max-height: 240px;
  overflow-y: auto;
}

.parsed-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.parsed-checklist-item:last-child {
  border-bottom: none;
}

.parsed-checklist-item.done {
  opacity: 0.6;
}

.parsed-checklist-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border-light);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.parsed-checklist-item.done .parsed-checklist-num {
  background: var(--green, #34a853);
  color: white;
}

.parsed-checklist-title {
  flex: 1;
  color: var(--text);
}

.parsed-checklist-item.done .parsed-checklist-title {
  text-decoration: line-through;
}

.parsed-checklist-check {
  color: var(--green, #34a853);
  font-weight: 700;
  font-size: 14px;
}

.parsed-checklist-note {
  font-size: 11px;
  color: var(--text-light);
  flex-shrink: 0;
}

.parsed-checklist-empty {
  padding: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
}

/* ===== 会计专区：收支损益表 ===== */
.fin-sub-tabs { display:flex; gap:0; margin-bottom:16px; border-bottom:2px solid var(--border-light); }
.fin-sub-btn { padding:10px 24px; border:none; background:none; font-size:15px; color:var(--text-secondary); cursor:pointer; border-bottom:3px solid transparent; margin-bottom:-2px; transition:all .2s; }
.fin-sub-btn:hover { color:var(--primary); }
.fin-sub-btn.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:600; }

.pl-sync-info { background:#E8F5E9; border:1px solid #C8E6C9; border-radius:8px; padding:8px 14px; font-size:13px; color:#2E7D32; }

.pl-table-container { overflow-x:auto; -webkit-overflow-scrolling:touch; }

.pl-paper { background:#fff; border:1px solid #ddd; border-radius:8px; padding:20px; min-width:900px; box-shadow:0 1px 3px rgba(0,0,0,.06); }
.pl-title { text-align:center; font-size:20px; font-weight:700; color:var(--text-primary); margin-bottom:4px; }
.pl-company { text-align:center; font-size:14px; color:var(--text-secondary); margin-bottom:16px; }

.pl-grid { width:100%; border-collapse:collapse; font-size:13px; }
.pl-grid thead th { background:#f5f5f5; border:1px solid #ddd; padding:8px 6px; font-weight:600; text-align:center; white-space:nowrap; }
.pl-c-cat { min-width:70px; } .pl-c-sub { min-width:90px; } .pl-c-sum { min-width:200px; text-align:left; }
.pl-c-num { min-width:90px; } .pl-c-act { min-width:100px; } .pl-c-date { min-width:100px; }

.pl-grid tbody td { border:1px solid #e0e0e0; padding:5px 6px; }
.pl-num { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }

.pl-section-row td { background:#E3F2FD; font-weight:700; color:#1565C0; padding:8px; }
.pl-cat-row td { background:#F5F5F5; font-weight:600; }
.pl-subcat-row td { background:#FAFAFA; font-style:italic; color:var(--text-secondary); }
.pl-detail-row:hover { background:#FFFDE7; }
.pl-task-row { background:#E8F5E9; }
.pl-task-row:hover { background:#C8E6C9; }

.pl-subtotal td { background:#F5F5F5; font-weight:600; border-top:2px solid #bbb; }
.pl-total-row td { background:#E3F2FD; font-weight:700; border-top:2px solid #90CAF9; }
.pl-grand-total td { background:#1565C0; color:#fff; font-weight:700; font-size:14px; border-top:3px solid #0D47A1; }
.pl-grand-total .pl-num { color:#fff; }
.pl-profit { font-weight:700; }

.pl-add-row td { padding:6px; text-align:left; }
.pl-add-row button { font-size:12px; color:var(--primary); }
.pl-empty td { padding:8px; }

.pl-tag-auto { display:inline-block; background:#C8E6C9; color:#2E7D32; font-size:10px; padding:1px 6px; border-radius:3px; margin-left:4px; }
.pl-tag-override { display:inline-block; background:#FFE0B2; color:#E65100; font-size:10px; padding:1px 6px; border-radius:3px; margin-left:4px; }

.pl-footnote { display:flex; gap:24px; justify-content:center; margin-top:12px; font-size:12px; color:var(--text-light); }

.btn-link { background:none; border:none; color:var(--primary); cursor:pointer; font-size:12px; padding:2px 6px; text-decoration:underline; }
.btn-link:hover { color:#1565C0; }
.btn-link-danger { background:none; border:none; color:#e53935; cursor:pointer; font-size:12px; padding:2px 6px; text-decoration:underline; }
.btn-link-danger:hover { color:#c62828; }
