/* ============ CSS 变量 ============ */
:root {
  --primary: #1a56db;
  --primary-light: #e0e7ff;
  --primary-dark: #1340a8;
  --success: #0e9f6e;
  --success-light: #d1fae5;
  --danger: #e02424;
  --danger-light: #fde8e8;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --info: #0694a2;
  --info-light: #def7ff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.14);
  --transition: all 0.2s ease;
}

/* ============ 基础重置 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, "微软雅黑", BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ 导航栏 ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.admin-badge {
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}
.nav-center { flex: 1; display: flex; justify-content: center; }
.nav-user { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.user-info { font-size: 0.875rem; color: var(--gray-600); }
.week-select {
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  background: var(--white);
  cursor: pointer;
  max-width: 320px;
}
.week-select:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; color: white; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #0b7a55; color: white; text-decoration: none; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-outline {
  background: transparent;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); color: var(--gray-900); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.8rem; font-size: 1rem; }

/* ============ 表单 ============ */
.form-group { margin-bottom: 1.1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}
.required { color: var(--danger); }
.form-control, input[type="text"], input[type="password"], input[type="email"], select, textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
textarea { resize: vertical; min-height: 80px; }

/* ============ 警告框 ============ */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-error { background: var(--danger-light); color: #c01c1c; border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.alert-info { background: var(--info-light); color: #0f4c5c; border: 1px solid #a5f3fc; }

/* ============ 徽章 ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-success { background: var(--success-light); color: #065f46; }
.badge-draft { background: var(--warning-light); color: #78350f; }

/* ============ 认证页面 ============ */
.auth-page { background: linear-gradient(135deg, #1a56db 0%, #6366f1 100%); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 460px; padding: 1.5rem; }
.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 1.8rem; }
.auth-logo { font-size: 3rem; margin-bottom: 0.5rem; line-height: 1; }
.auth-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); }
.auth-header p { color: var(--gray-500); font-size: 0.9rem; margin-top: 0.3rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--gray-400); font-size: 0.8rem; }

/* Tab */
.tab-nav { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.5rem; }
.tab-btn {
  flex: 1;
  padding: 0.7rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--primary); }

/* ============ 主布局 ============ */
.main-container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

/* ============ 周报头部 ============ */
.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.report-title-block h2 { font-size: 1.2rem; color: var(--gray-900); }
.week-range { font-size: 0.85rem; color: var(--gray-500); margin-top: 0.2rem; }
.report-status-block { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.report-status-block small { font-size: 0.75rem; color: var(--gray-500); }

/* ============ 任务区域 ============ */
.tasks-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--gray-200);
}
.section-header h3 { font-size: 1rem; color: var(--gray-800); }

/* 任务卡片 */
.task-list { display: flex; flex-direction: column; gap: 1rem; }
.task-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  animation: slideIn 0.3s ease;
}
.task-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(26,86,219,0.1); }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.task-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.task-number {
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.task-title-display { flex: 1; font-weight: 600; color: var(--gray-800); }
.task-actions { display: flex; gap: 0.4rem; }
.btn-icon {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.btn-edit:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-delete:hover { background: var(--danger-light); border-color: var(--danger); }
.task-card-body { padding: 1rem 1.1rem; }
.task-field { margin-bottom: 0.75rem; }
.task-field:last-child { margin-bottom: 0; }
.task-field label { font-size: 0.78rem; color: var(--gray-500); font-weight: 600; margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.03em; }
.field-content { font-size: 0.9rem; color: var(--gray-700); line-height: 1.6; white-space: pre-wrap; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; line-height: 1; }
.empty-state p { font-size: 0.9rem; }

/* 操作栏 */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--gray-200);
}

/* ============ 模态框 ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
}
.modal-content {
  position: relative;
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-sm { max-width: 380px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 1rem; color: var(--gray-900); }
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
}

/* ============ Toast 提示 ============ */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  background: var(--gray-900);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 300px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ============ 成功页面 ============ */
.success-banner {
  background: linear-gradient(135deg, #0e9f6e, #06b6d4);
  color: white;
  text-align: center;
  padding: 3rem 2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.success-icon { font-size: 4rem; margin-bottom: 1rem; line-height: 1; }
.success-banner h2 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.success-banner p { opacity: 0.9; }

.report-preview {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.preview-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-200); }
.preview-header h3 { font-size: 1rem; color: var(--gray-800); margin-bottom: 0.5rem; }
.preview-meta { display: flex; gap: 1rem; flex-wrap: wrap; }
.preview-meta span { font-size: 0.85rem; color: var(--gray-500); }
.preview-task {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.preview-task:last-child { border-bottom: none; }
.preview-task-number {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.preview-task-content { flex: 1; }
.preview-task-content h4 { font-size: 0.95rem; color: var(--gray-800); margin-bottom: 0.5rem; }
.preview-field { font-size: 0.875rem; color: var(--gray-600); margin-bottom: 0.3rem; }
.field-label { font-weight: 600; color: var(--gray-500); }

.success-actions { display: flex; gap: 1rem; justify-content: center; }

/* ============ 管理员页面 ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card.stat-action { justify-content: center; }
.stat-icon { font-size: 1.8rem; line-height: 1; }
.stat-number { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--gray-500); }

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.sidebar-panel, .main-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
}
.sidebar-panel h3, .main-panel .panel-header h3 { font-size: 0.95rem; color: var(--gray-800); margin-bottom: 1rem; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--gray-200); }

.member-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.member-item:last-child { border-bottom: none; }
.member-avatar { font-size: 1.3rem; line-height: 1; }
.member-info { flex: 1; }
.member-info strong { display: block; font-size: 0.875rem; color: var(--gray-800); }
.member-info small { font-size: 0.75rem; color: var(--gray-500); }
.member-time { font-size: 0.75rem; color: var(--gray-400); }

/* 汇总任务卡片 */
.summary-task-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
  overflow: hidden;
}
.summary-task-card:last-child { margin-bottom: 0; }
.summary-task-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
}
.summary-number { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.summary-task-header h4 { flex: 1; font-size: 0.95rem; font-weight: 600; }
.summary-count {
  background: rgba(255,255,255,0.25);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.summary-task-body { padding: 0.75rem; }
.summary-item {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}
.summary-item:last-child { margin-bottom: 0; }
.summary-item-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.summary-order { color: var(--primary); font-weight: 700; }
.summary-author { font-size: 0.875rem; }
.summary-author strong { color: var(--gray-800); }
.summary-author em { color: var(--gray-500); font-style: normal; font-size: 0.8rem; }
.summary-progress, .summary-next-plan { display: flex; gap: 0.5rem; font-size: 0.875rem; line-height: 1.6; }
.progress-label { color: var(--gray-500); font-weight: 600; white-space: nowrap; font-size: 0.8rem; }
.progress-text { color: var(--gray-700); }
.summary-next-plan { margin-top: 0.3rem; }

/* ============ 工具类 ============ */
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-brand { font-size: 0.95rem; }
  .nav-center { display: none; }
  .main-container { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 1.8rem; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .success-actions { flex-direction: column; }
}
