:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e6e6e9;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #62626b;
  --text-3: #9a9aa3;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --green: #16a34a;
  --green-soft: #eefaf1;
  --amber: #d97706;
  --amber-soft: #fef7ec;
  --gray-soft: #f2f2f4;
  --red: #dc2626;
  --radius: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--accent); flex-shrink: 0;
}
.topbar h1 { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.actions { display: flex; gap: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--gray-soft); opacity: 1; }
.btn.danger { color: var(--red); border-color: #f3c9c9; }
.btn.danger:hover { background: #fdf2f2; }
.btn.block { display: block; width: 100%; margin-bottom: 8px; text-align: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 筛选 ---------- */
.filters {
  display: flex; gap: 8px; padding: 16px 24px 4px;
  overflow-x: auto; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  font: inherit; font-size: 13px; padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.chip:hover { border-color: #bfbfc6; }
.chip.is-active {
  background: var(--text); color: #fff; border-color: var(--text);
}

/* ---------- 看板 ---------- */
.board {
  display: grid; gap: 12px; padding: 16px 24px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: var(--border-strong); box-shadow: 0 1px 6px rgba(0,0,0,.05); }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-name { font-size: 15px; font-weight: 600; letter-spacing: -.2px; word-break: break-word; }
.card-desc { font-size: 13px; color: var(--text-2); line-height: 1.55; }

.badge {
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
}
.badge.active   { background: var(--accent-soft); color: var(--accent); }
.badge.paused   { background: var(--amber-soft); color: var(--amber); }
.badge.done     { background: var(--green-soft); color: var(--green); }
.badge.archived { background: var(--gray-soft); color: var(--text-3); }

.bar { height: 5px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.badge.done ~ .bar span, .card.is-done .bar span { background: var(--green); }

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 12px; color: var(--text-3);
}
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: var(--gray-soft); color: var(--text-2);
}

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 80px 24px; }
.empty-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-2); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(24,24,27,.42);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.modal-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; width: 100%; max-width: 460px;
  display: flex; flex-direction: column; gap: 14px;
  max-height: calc(100vh - 48px); overflow-y: auto;
}
.modal-card.compact { max-width: 380px; }
.modal-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 2px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.req { color: var(--red); }
.hint { font-size: 12px; color: var(--text-3); font-weight: 400; }

input[type=text], input[type=date], textarea, select {
  font: inherit; font-size: 14px; color: var(--text);
  padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  width: 100%; transition: border-color .15s;
}
input[type=text]:focus, input[type=date]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
}
textarea { resize: vertical; min-height: 60px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border);
}
.menu-note {
  font-size: 12px; color: var(--text-2); line-height: 1.7;
  background: var(--amber-soft); padding: 11px 13px; border-radius: 8px;
}
.menu-note b { color: var(--amber); font-weight: 600; }

/* ---------- 详情抽屉 ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(520px, 100%); background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.drawer-head h2 { font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.drawer-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: space-between;
}
.icon-btn {
  font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
  border: none; background: none; color: var(--text-3); padding: 4px 8px;
  border-radius: 6px;
}
.icon-btn:hover { background: var(--gray-soft); color: var(--text); }

.log-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.log-item {
  border-left: 2px solid var(--border-strong); padding: 2px 0 2px 12px;
  display: flex; justify-content: space-between; gap: 10px;
}
.log-date { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.log-text { font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

.section-title {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .5px; margin-top: 4px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--text); color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 999px; z-index: 100;
  animation: fadeUp .2s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .filters { padding: 12px 16px 4px; }
  .board { padding: 12px 16px; grid-template-columns: 1fr; }
}
