:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e4e8ee;
  --border-strong: #d3d9e2;
  --text: #1d2430;
  --text-2: #5b6675;
  --text-3: #8b95a3;
  --primary: #2563eb;
  --primary-soft: #eaeefc;
  --success: #16a34a;
  --success-soft: #e7f6ed;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdeceb;
  --purple: #7c3aed;
  --purple-soft: #f1ebfe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

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

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

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: inherit;
}

/* ---------- 布局 ---------- */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 24px;
}
.brand { font-size: 16px; font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--primary); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 14px;
  border-radius: 7px;
  color: var(--text-2);
  font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }
.wrap.narrow { max-width: 720px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--text-3); font-size: 13px; }

/* ---------- 卡片 / 网格 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card.pad0 { padding: 0; overflow: hidden; }
.card-title { font-size: 15px; font-weight: 650; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat .lbl { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }

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

.proj-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  cursor: pointer; transition: border-color .12s, transform .12s, box-shadow .12s;
  display: flex; flex-direction: column; gap: 10px;
}
.proj-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37, 99, 235, .10); }
.proj-card h4 { margin: 0; font-size: 15px; font-weight: 650; }
.proj-meta { color: var(--text-3); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }
.progress { height: 6px; background: #eef1f5; border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.lastlog { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 7px; padding: 7px 10px; }
.lastlog .t { color: var(--text-3); }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 500;
  background: #eef1f5; color: var(--text-2); white-space: nowrap;
}
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.orange { background: var(--warn-soft); color: var(--warn); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.purple { background: var(--purple-soft); color: var(--purple); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-weight: 500; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1d4fd8; }
.btn.danger { color: var(--danger); border-color: #f0c9c7; background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.input, .select, textarea.input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
textarea.input { resize: vertical; min-height: 78px; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12.5px; color: var(--text-3); font-weight: 600; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- 时间线 ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button {
  padding: 8px 14px; border: none; background: transparent; cursor: pointer;
  color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border);
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong);
}
.tl-item.t-progress::before { border-color: var(--primary); }
.tl-item.t-task::before { border-color: var(--warn); }
.tl-item.t-file::before { border-color: var(--purple); }
.tl-item.t-note::before { border-color: var(--success); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.tl-time { color: var(--text-3); font-size: 12.5px; }
.tl-body { white-space: pre-wrap; word-break: break-word; }
.tl-actions { margin-top: 6px; display: flex; gap: 6px; }

/* ---------- 任务 ---------- */
.task-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-strong);
  background: var(--surface); cursor: pointer; flex-shrink: 0; margin-top: 3px;
  display: flex; align-items: center; justify-content: center; color: transparent; font-size: 11px;
}
.task-check.checked { background: var(--success); border-color: var(--success); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-item.done .task-title { text-decoration: line-through; color: var(--text-3); }

/* ---------- 文件 ---------- */
.file-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.file-item:last-child { border-bottom: none; }
.file-icon {
  width: 36px; height: 36px; border-radius: 8px; background: var(--purple-soft); color: var(--purple);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0;
}

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px;
  z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, .22); overflow: hidden;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 650; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
.x { cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; background: none; border: none; }
.x:hover { color: var(--text); }

/* ---------- 登录 ---------- */
.login-box { max-width: 380px; margin: 90px auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.login-box h2 { margin: 0 0 6px; font-size: 20px; }
.login-box .hint { color: var(--text-3); font-size: 13px; margin-bottom: 22px; }

.share-hero { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.share-hero h2 { margin: 0 0 4px; font-size: 20px; }
.share-hero p { margin: 0; opacity: .88; font-size: 13px; }

.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty .big { font-size: 34px; margin-bottom: 8px; }

.alert { padding: 10px 13px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--success-soft); color: var(--success); }
.alert.info { background: var(--primary-soft); color: var(--primary); }

.copy-box { display: flex; gap: 8px; align-items: center; }
.copy-box .input { font-family: Consolas, Monaco, monospace; font-size: 12.5px; }

.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: Consolas, Monaco, monospace; }
.badge-internal { background: var(--warn-soft); color: var(--warn); padding: 1px 7px; border-radius: 20px; font-size: 12px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- 我的任务 / 提醒 / 操作日志 ---------- */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 2px;
  background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.remind { border-color: var(--warn-soft); background: var(--warn-soft); }
.remind .card-title { color: var(--warn); }
.remind-list { display: flex; flex-direction: column; gap: 8px; }
.remind-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.remind-item.overdue { color: var(--danger); }
.remind-item .overdue { color: var(--danger); font-weight: 600; }
.row-overdue { background: var(--danger-soft); }
.row-overdue:hover { background: #fbe3e1; }
.overdue { color: var(--danger); font-weight: 600; }

/* ---------- 客户留言板（分享页 / 管理端） ---------- */
.conv { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 14px; max-height: 360px; overflow-y: auto; }
.conv-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff;
}
.conv-item.mine { background: #eef4ff; border-color: #cfe0ff; align-self: stretch; }
.conv-item.unread { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger-soft); }
.conv-meta { font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.conv-text { font-size: 14px; color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.conv-box { border-top: 1px dashed var(--border); padding-top: 12px; }
.conv-box textarea { resize: vertical; }

.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-row .input, .filter-row .select { min-width: 130px; flex: 1 1 150px; }
.filter-row .input[type="date"] { flex: 0 1 150px; }

@media (max-width: 720px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .wrap { padding: 16px; }
  .topbar { padding: 0 14px; gap: 12px; }
  .nav a { padding: 6px 9px; font-size: 13px; }
}
