/* ═══ Scheme B 配色 + iPhone 极简风格 ═══ */
:root {
  --primary: #006666;
  --bg: #F0F4F4;
  --accent: #C45C3A;
  --text: #1A2E2E;
  --text-light: #8A9E9E;
  --card: #F8FAFA;
  --border: #e0e8e8;
  --radius: 12px;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

/* Navbar */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
}
.nav-icon { width: 22px; height: 22px; }
.nav-right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav-btn { color: #fff; opacity: 0.9; }
.nav-btn:hover { opacity: 1; }
.nav-user { font-weight: 500; }
.nav-logout { color: rgba(255,255,255,.7); font-size: 13px; }

.main { max-width: 720px; margin: 0 auto; padding: 16px; }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 16px; background: var(--card); border-radius: var(--radius); padding: 4px; border: 1px solid var(--border); }
.tab { flex: 1; padding: 10px; text-align: center; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-light); border: none; background: none; transition: .15s; }
.tab.active { background: var(--primary); color: #fff; }

/* Toolbar */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 14px; }
.toolbar input { flex: 1; min-width: 140px; }
.btn { padding: 9px 18px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #005555; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: #fff; color: var(--accent); border: 1px solid var(--accent); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; cursor: pointer; transition: box-shadow .15s; }
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-meta { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* Badges */
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.badge-high { background: #fef2f2; color: var(--accent); }
.badge-medium { background: #f0fdf4; color: #10b981; }
.badge-low { background: #e0e8e8; color: #8A9E9E; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-pending { background: #8A9E9E; }
.dot-in_progress { background: #f59e0b; }
.dot-active { background: #3b82f6; }
.dot-completed { background: #10b981; }

/* Status badge */
.badge-status-pending { background: #e0e8e8; color: #8A9E9E; font-size: 10px; padding: 2px 6px; border-radius: 8px; }
.badge-status-in_progress { background: #fef3c7; color: #d97706; font-size: 10px; padding: 2px 6px; border-radius: 8px; }
.badge-status-active { background: #dbeafe; color: #2563eb; font-size: 10px; padding: 2px 6px; border-radius: 8px; }
.badge-status-completed { background: #d1fae5; color: #059669; font-size: 10px; padding: 2px 6px; border-radius: 8px; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto; padding: 24px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-light); }
.modal input, .modal textarea, .modal select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; font-size: 14px; background: #fff; }
.modal textarea { min-height: 80px; resize: vertical; }
.modal .form-row { display: flex; gap: 8px; }
.modal .form-row > * { flex: 1; }
.modal .btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* Comments */
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment strong { font-size: 11px; color: var(--text-light); font-weight: 400; }
.comment time { font-size: 11px; color: var(--text-light); margin-left: 4px; }
.comment p { font-size: 15px; color: #1A2E2E; margin-top: 4px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1A2E2E; color: #fff; padding: 10px 24px; border-radius: 10px; font-size: 14px; z-index: 300; display: none; }

/* Empty */
.empty { text-align: center; padding: 48px 20px; color: var(--text-light); }
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; color: var(--text-light); }
.empty p { font-size: 14px; }

/* Tab Bar */
.tab-bar { display:flex; background:#fff; border-top:1px solid var(--border); position:fixed; bottom:0; left:0; right:0; z-index:100; padding:4px 0 env(safe-area-inset-bottom,4px) 0; box-shadow:0 -2px 8px rgba(0,0,0,.06); }
.tab-item { flex:1; text-align:center; padding:5px 0 3px; cursor:pointer; color:var(--text-light); font-size:10px; border:none; background:none; transition:color .15s; display:flex; flex-direction:column; align-items:center; gap:1px; font-weight:500; -webkit-tap-highlight-color:transparent; position:relative; }
.tab-item.active { color:var(--primary); font-weight:600; }
.tab-item.active::after { content:''; position:absolute; top:-1px; left:50%; transform:translateX(-50%); width:20px; height:3px; background:var(--primary); border-radius:0 0 2px 2px; }

/* 操作类tab vs 查询类tab 视觉区分 */
.tab-item.query { color:var(--text-meta); }
.tab-item.query.active { color:#4A9E9E; }
.tab-item.query.active::after { background:#4A9E9E; width:14px; }
.tab-item.query svg { opacity:0.75; }
.tab-item.query.active svg { opacity:1; }

/* 操作/查询分组分隔线 */
.tab-divider { width:1px; height:24px; background:var(--border); margin:5px 0; align-self:center; flex-shrink:0; }
.tab-item svg { width:22px; height:22px; }

/* ═══ Card left border accents ═══ */
.card.memo-card { border-left: 3px solid #006666; }
.card.cp-card-accent { border-left: 3px solid #10b981; }
.card.task-card-accent { border-left: 3px solid #f59e0b; }
.cp-card { border-left: 3px solid #10b981; }

/* High priority gradient */
.card.priority-high, .cp-card.priority-high {
  background: linear-gradient(to right, #fef2f2, #F8FAFA);
}

/* ═══ Progress entry in checkpoint detail ═══ */
.cp-body .progress-entry {
  padding: 10px 0 10px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: #006666;
  border-left: 2px solid #006666;
}
.cp-body .progress-entry:last-child { border-bottom: none; }
.cp-body .progress-meta { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* Node description in expanded body */
.cp-body .cp-desc { font-size: 14px; color: #000000; line-height: 1.5; margin-bottom: 10px; }

/* Modal description content */
.modal-desc { font-size: 14px; color: #1A2E2E; }

/* ═══ Task progress log in detail ═══ */
.progress-log-entry {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.progress-log-entry:last-child { border-bottom: none; }
.pl-meta { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ═══ Image overlay ═══ */
.image-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 300;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.image-overlay.show { display: flex; }
.image-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ═══ Image previews ═══ */
.image-thumb {
  width: 80px; height: 80px;
  object-fit: contain;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fafafa;
  transition: transform .15s;
}
.image-thumb:hover { transform: scale(1.05); }

/* ═══ Attachment badge ═══ */
.attach-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 4px 10px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; margin: 2px 4px 2px 0;
  color: var(--primary); text-decoration: none;
}
.attach-badge:hover { background: #e8f5f5; }

/* ═══ Upload drop zone ═══ */
.upload-dropzone {
  border: 2px dashed #e0e8e8; border-radius: 10px;
  padding: 20px; text-align: center; margin-bottom: 10px;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(0,102,102,.04);
}

/* ═══ Complete/restore button ═══ */
.btn-done {
  padding: 5px 7px;
  border-radius: 6px; border: 1px solid #10b981;
  background: #ecfdf5; color: #10b981;
  cursor: pointer; font-weight: 500; display: inline-flex; align-items: center;
  transition: .15s;
}
.btn-done:hover { background: #d1fae5; }
.btn-restore {
  padding: 5px 7px;
  border-radius: 6px; border: 1px solid var(--accent);
  background: #fef2f2; color: var(--accent);
  cursor: pointer; font-weight: 500; display: inline-flex; align-items: center;
  transition: .15s;
}
.btn-restore:hover { background: #fee2e2; }

@media (max-width: 480px) {
  .main { padding: 10px; }
  .navbar { padding: 0 14px; }
  .modal { padding: 18px; border-radius: 12px; }
}

/* ═══ Completed items toggle ═══ */
.toggle-arrow.open { transform: rotate(180deg); }
.completed-div.show { display: block !important; }

/* ═══ Profile page ═══ */
.profile-card {
  text-align: center; padding: 24px 0 16px;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #1a8a8a);
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.profile-name { font-size: 18px; font-weight: 700; color: var(--text); }
.profile-role { font-size: 13px; color: var(--text-light); margin-top: 2px; }
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-top: 14px;
}
.stat-card {
  background: var(--card); border-radius: 10px; padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 2px; }
