/* =============================================
   Airtable 设计系统 — 企业微信日报监控驾驶舱
   Source: airtable.com
   Signature: Editorial white canvas, near-black ink,
   clean 12px radius buttons, signature coral/forest
   accent cards, sober minimalism
   ============================================= */

/* --- 字体加载 --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* --- 设计令牌 --- */
:root {
  /* 品牌色 */
  --primary: #181d26;
  --primary-active: #0d1218;
  --on-primary: #ffffff;
  --link: #1b61c9;
  --link-active: #1a3866;
  --success: #006400;
  --success-border: #39bf45;
  --info: #254fad;
  --info-border: #458fff;

  /* 画布与表面 */
  --canvas: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #e0e2e6;
  --surface-dark: #181d26;
  --surface-1: #f8fafc;

  /* 分割线 */
  --hairline: #dddddd;
  --border-strong: #9297a0;

  /* 文字层级 */
  --ink: #181d26;
  --body: #333840;
  --muted: #41454d;
  --ink-subtle: #41454d;
  --ink-tertiary: #6b6f7e;
  --ink-muted: #6b6f7e;
  --ink-placeholder: #9297a0;

  /* 签名色 (用于点缀卡片) */
  --signature-coral: #aa2d00;
  --signature-forest: #0a2e0e;
  --signature-cream: #f5e9d4;

  /* 语义色 */
  --warning: #d9a441;
  --danger: #c9302c;
  --danger-bg: #fce8e6;

  /* 排版 */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* 圆角 — Airtable: 分层 radius, 非 pill */
  --radius-xs: 2px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* 间距 (4px 基单位) */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  /* 阴影 — Airtable: minimal, color-block first */
  --shadow-card: rgba(0, 0, 0, 0.04) 0px 2px 6px;
  --shadow-dropdown: rgba(0, 0, 0, 0.10) 0px 8px 24px;

  /* 过渡 */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

/* --- 重置 & 基础 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--body);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* --- 容器 --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- 头部导航 (Airtable: 64px white bar) --- */
.header {
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
  padding: 0 var(--space-md);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: var(--space-sm);
}

.header-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.header-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 1px;
}

/* --- 按钮 (Airtable: 12px radius, 16px font, clean) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  min-height: 40px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-active);
  border-color: var(--primary-active);
}
.btn-primary:active:not(:disabled) {
  background: #000000;
}

.btn-secondary {
  background: var(--canvas);
  color: var(--ink);
  border-color: var(--hairline);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-soft);
}
.btn-secondary:active:not(:disabled) {
  background: var(--surface-strong);
}

.btn-success {
  background: var(--success);
  color: var(--on-primary);
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-sm {
  font-size: 13px;
  padding: 6px 14px;
  min-height: 32px;
}

/* --- 标签页 (Airtable: clean pills in soft surface) --- */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-soft);
  padding: 3px;
  border-radius: var(--radius-md);
  width: fit-content;
  margin-bottom: var(--space-lg);
}

.tab-item {
  position: relative;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}

.tab-item:hover {
  color: var(--ink);
}

.tab-item.active {
  background: var(--canvas);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* --- Tab 红点徽章 (微信风格未读消息) --- */
.tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #c9302c;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 0 0 2px var(--surface-soft);
}
.tab-badge:empty { display: none; }

/* --- 进度条 (Airtable: slim, near-black) --- */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--hairline);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal);
}

.progress-text {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}

/* --- 卡片网格 --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 255px);
  gap: var(--space-sm);
  margin-bottom: var(--space-xxl);
}

/* --- 项目卡片 (Airtable: white card, 10px radius, minimal) --- */
.project-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  transition: box-shadow var(--duration-fast);
  cursor: default;
  width: 255px;
  height: 128px;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  box-shadow: var(--shadow-card);
}

.project-card.status-sent {
  background: rgba(0, 100, 0, 0.06);
  border-color: rgba(0, 100, 0, 0.25);
}

.project-card.status-unsent {
  background: rgba(201, 48, 44, 0.06);
  border-color: rgba(201, 48, 44, 0.25);
}

.project-card.status-pending {
  background: rgba(217, 164, 65, 0.06);
  border-color: rgba(217, 164, 65, 0.25);
}

.project-card.status-paused {
  background: rgba(217, 164, 65, 0.04);
  border-color: rgba(217, 164, 65, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  flex: 1;
}

.card-info {
  margin-bottom: var(--space-sm);
}

.card-info-item {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--hairline);
}

/* --- 徽章 (Airtable: clean pills, 6px radius) --- */
.card-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.badge-sent {
  background: #e8f5e9;
  color: #006400;
}

.badge-pending {
  background: #fff8e1;
  color: #8d6e00;
}

.badge-unsent {
  background: var(--surface-soft);
  color: var(--muted);
}

.badge-warning {
  background: #fff8e1;
  color: #8d6e00;
}

/* --- 搜索高亮 (Airtable: info-blue outline) --- */
.search-highlight {
  outline: 2px solid var(--info-border);
  outline-offset: 2px;
}

/* --- 过滤器 --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

/* --- 筛选标签 (Airtable: clean chip) --- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}
.filter-chip:hover {
  background: var(--surface-soft);
}
.filter-chip.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

/* --- 输入框 (Airtable: text-input) --- */
.form-group {
  margin-bottom: var(--space-lg);
}

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

.form-input,
.form-textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  line-height: 1.5;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  outline: none;
  min-height: 44px;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--info-border);
  box-shadow: 0 0 0 3px rgba(69, 143, 255, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--border-strong);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239297a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* --- 预览图片 --- */
.screenshot-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  margin-top: var(--space-xs);
}

/* --- 弹窗 (Airtable modal) --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 29, 38, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: var(--canvas);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-dropdown);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-lg);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
}

/* --- 单选卡片 (Airtable: clean bordered card) --- */
.radio-card {
  flex: 1;
  cursor: pointer;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  transition: all var(--duration-fast);
}
.radio-card:hover {
  border-color: var(--border-strong);
}
.radio-card.active {
  border-color: var(--primary);
  background: var(--surface-soft);
}
.radio-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.radio-card-desc {
  font-size: 12px;
  color: var(--muted);
}

/* --- 提示条 (cream callout) --- */
.inline-notice {
  background: var(--signature-cream);
  border: 1px solid #e8dcc8;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 13px;
  color: var(--ink);
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

/* --- Required 标记 --- */
.required {
  color: var(--danger);
}

/* --- 日报预览 (Airtable: soft surface) --- */
.report-preview {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-family: var(--font-body);
}

/* --- 历史记录 --- */
.history-item {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}
.history-item:last-child {
  margin-bottom: 0;
}

/* --- 统计栏 (Airtable: clean stat cards) --- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

/* --- 趋势条 (Airtable: thin near-black) --- */
.trend-bar {
  height: 4px;
  background: var(--hairline);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 6px;
}
.trend-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* --- 排名列表 --- */
.rank-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--hairline);
}
.rank-item:last-child {
  border-bottom: none;
}
.rank-number {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.rank-1 {
  background: var(--primary);
  color: var(--on-primary);
}
.rank-other {
  background: var(--surface-soft);
  color: var(--muted);
}

/* --- 状态点 --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.sent { background: var(--success); }
.status-dot.pending { background: var(--warning); }
.status-dot.unsent { background: var(--border-strong); }

/* --- Toast 通知 (Airtable: near-black, 12px radius) --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary);
  color: var(--on-primary);
  padding: 12px 28px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  transition: all var(--duration-normal);
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- 加载 & 空状态 --- */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-state .icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}
.empty-state .icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--muted);
}

/* --- 响应式 --- */
@media (max-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(3, 255px);
  }
}

@media (max-width: 768px) {
  .header {
    height: auto;
    padding: var(--space-sm) var(--space-md);
  }
  .header-row {
    flex-wrap: wrap;
  }
  .card-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .modal-box {
    padding: var(--space-lg);
  }
  .tabs {
    width: 100%;
  }
  .tab-item {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .header-title {
    font-size: 15px;
  }
  .btn {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }
}

/* --- 打印样式 --- */
@media print {
  .header, .action-bar, .btn, .filter-bar {
    display: none !important;
  }
}

/* --- 区段标题 --- */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-md);
  letter-spacing: -0.1px;
}

/* --- 底部操作栏 --- */
.action-bar {
  position: sticky;
  bottom: 0;
  background: var(--canvas);
  border-top: 1px solid var(--hairline);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-xs);
  z-index: 100;
}

/* --- 表单页面 --- */
.form-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

/* --- 分割线 --- */
hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: var(--space-xl) 0;
}

/* --- PMO 特有 --- */
.pmo-header-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* --- 审核操作按钮组 --- */
.review-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.review-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin-bottom: 1px;
}
.review-card:last-child { margin-bottom: 0; }

/* --- 项目名点击跳转 --- */
.project-name-link {
  color: var(--link);
  cursor: pointer;
}
.project-name-link:hover {
  text-decoration: underline;
}

/* --- 卡片下拉菜单 --- */
.card-menu-wrap {
  position: relative;
  margin-left: auto;
}
.card-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-menu-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink-tertiary);
  stroke-width: 2;
  fill: none;
}
.card-menu-btn:hover svg {
  stroke: var(--ink);
}
.card-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 120px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-dropdown);
  z-index: 1000;
  padding: 4px 0;
}
.card-dropdown.show {
  display: block;
}
.dropdown-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--body);
  cursor: pointer;
  white-space: nowrap;
}
.dropdown-item:hover {
  background: var(--surface-soft);
}
