:root {
  --green: #5a9e6f;
  --green-deep: #3f7d54;
  --green-light: #eef3ec;
  --green-faint: #f6f9f4;
  --ink: #2b3a2e;
  --ink-soft: #5c6b5e;
  --line: #e2e9df;
  --white: #fff;
  --danger: #c0504d;
  --warn: #c8923a;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--green-light);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--green-light);
}

/* 顶部栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #6cae82, #3f7d54);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.brand-dot {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.brand-name { font-size: 16px; }
.topbar-user { font-size: 13px; opacity: .9; }

/* 主内容 */
.main { flex: 1; padding: 12px 12px 90px; overflow-y: auto; }

/* 底部导航 */
.tabbar {
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--line);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  font-size: 11px;
}
.tab.active { color: var(--green-deep); }
.tab-icon { font-size: 20px; }

/* 卡片 */
.card {
  background: var(--white);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(63,125,84,.06);
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px; cursor: pointer;
  font-size: 15px; padding: 10px 20px; height: 44px;
}
.btn-primary { background: linear-gradient(135deg, #6cae82, #3f7d54); color: #fff; }
.btn-ghost { background: var(--white); color: var(--green-deep); border: 1px solid #bcd6c2; }
.btn-danger { background: var(--white); color: var(--danger); border: 1px solid #e5b9b7; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; }

/* 悬浮按钮 */
.fab {
  position: fixed;
  right: 24px; bottom: 90px;
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #6cae82, #3f7d54);
  color: #fff; font-size: 28px; border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(63,125,84,.35);
  z-index: 15;
}

/* 任务条目 */
.task-item {
  display: flex; align-items: center;
  background: var(--white);
  border-radius: 12px; padding: 12px; margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(63,125,84,.05);
  cursor: pointer;
}
.task-bar { width: 6px; height: 44px; border-radius: 6px; margin-right: 12px; flex-shrink: 0; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 15px; }
.task-meta { color: var(--ink-soft); font-size: 12px; margin-top: 3px; }
.task-status { margin-left: 10px; font-size: 20px; color: #c4cfc6; }
.task-status.done { color: var(--green-deep); }
.prio-tag { font-size: 11px; flex-shrink: 0; margin-left: 8px; }

/* 日历 */
.cal-weekdays { display: flex; }
.cal-weekday { flex: 1; text-align: center; color: #8a9a8c; font-size: 12px; padding: 6px 0; }
.cal-grid { display: flex; flex-wrap: wrap; background: var(--white); border-radius: 12px; overflow: hidden; }
.cal-cell {
  width: 14.285%; height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; font-size: 14px;
}
.cal-cell.dim { color: #c4cfc6; }
.cal-cell.today { color: var(--green-deep); font-weight: 700; }
.cal-cell.selected { background: var(--green-light); border-radius: 10px; }
.cal-dot {
  margin-top: 4px; min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  background: var(--green); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 4px;
}

/* 表单 */
.field { padding: 12px 0; border-bottom: 1px solid var(--green-faint); }
.field:last-child { border-bottom: none; }
.label { display: block; font-size: 13px; color: #8a9a8c; margin-bottom: 6px; }
.input, .textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; color: var(--ink); background: var(--green-faint);
}
.textarea { min-height: 80px; resize: vertical; }
.input:focus, .textarea:focus, select:focus { outline: none; border-color: var(--green); }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30;
}
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: calc(100% - 48px); max-width: 440px; max-height: 80vh; overflow-y: auto;
  background: var(--white); border-radius: 16px; padding: 20px; z-index: 31;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 14px; }

/* toast */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 14px; z-index: 40; max-width: 80%;
}

/* 工具类 */
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.flex1 { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.t-strong { font-weight: 600; }
.t-soft { color: var(--ink-soft); }
.t-green { color: var(--green-deep); }
.t-danger { color: var(--danger); }
.t-sm { font-size: 12px; }
.t-xs { font-size: 11px; }
.t-lg { font-size: 17px; }
.t-xl { font-size: 22px; }
.t-center { text-align: center; }
.empty { text-align: center; color: #9aac9d; padding: 40px 0; font-size: 13px; }
.empty-icon { font-size: 40px; margin-bottom: 8px; opacity: .6; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }

/* ===== 桌面端适配（> 760px 自动切宽屏布局） ===== */
@media (min-width: 761px) {
  .app { max-width: 1080px; }
  .topbar { border-radius: 0 0 16px 16px; }
  .main { padding: 20px 20px 90px; }

  /* 内容容器居中并限宽，避免过宽 */
  #main { max-width: 880px; margin: 0 auto; width: 100%; }

  /* 日历单元格加高，配合大屏 */
  .cal-cell { height: 72px; }

  /* 任务卡片在宽屏下更疏朗 */
  .task-item { padding: 14px 16px; }

  /* 底部导航居中限宽 */
  .tabbar { max-width: 1080px; }
}

