 /* ============================================================
 * 手账待办 · 手绘笔记本风格 CSS
 * 色值: #F8F6EF #E2E0D6 #222 #70B873 #F3E2E2 #F6F3E8
 *      #F9DD99 #B8D8F0 #F8C8D0
 * ============================================================ */

:root {
  --paper:      #F8F6EF;
  --grid:       #E2E0D6;
  --ink:        #222222;
  --ink-light:  #555555;
  --check:      #70B873;
  --hl:         #F3E2E2;
  --time-bg:    #F6F3E8;
  --ld-yellow:  #F9DD99;
  --ld-blue:    #B8D8F0;
  --ld-pink:    #F8C8D0;
  --card-bg:    #FFFFFF;
  --border:     #D8D5CB;

  --font-title: 'ZCOOL KuaiLe', 'Ma Shan Zheng', cursive;
  --font-body:  'Ma Shan Zheng', 'ZCOOL KuaiLe', cursive;

  --radius-card:  18px;
  --radius-sm:    10px;
  --radius-pill:  20px;
}

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

html, body {
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  font-size: 16px;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ============================================================
 * 顶部导航栏
 * ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border-bottom: 2px solid var(--ink);
  padding: 10px 24px;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-deco {
  display: inline-block;
  width: 28px;
  height: 4px;
  border-radius: 2px;
}
.brand-deco-left  { background: var(--ld-yellow); }
.brand-deco-right { background: var(--ld-pink); }
.brand-title {
  font-family: var(--font-title);
  font-size: 26px;
  letter-spacing: 2px;
}

.nav-tabs {
  display: flex;
  gap: 6px;
}
.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--ink-light);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card-bg);
  transition: all .2s;
}
.nav-tab:hover { border-color: var(--ink); }
.nav-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.nav-tab-emoji { font-size: 18px; }

/* ============================================================
 * 主区域
 * ============================================================ */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
 * 笔记本卡片通用
 * ============================================================ */
.notebook {
  position: relative;
  background: var(--card-bg);
  border: 2px solid var(--ink);
  border-radius: var(--radius-card);
  padding-top: 18px;
  box-shadow: 3px 4px 0 rgba(34,34,34,.08);
}

/* 螺旋装订环 */
.spiral-bind {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  z-index: 5;
}
.sp-ring {
  display: block;
  width: 16px;
  height: 18px;
  border: 2.5px solid var(--ink);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--card-bg);
}
.spiral-sm .sp-ring { width: 13px; height: 15px; border-width: 2px; }
.spiral-dense .sp-ring { width: 14px; height: 16px; border-width: 2.5px; }

.nb-body {
  padding: 20px 24px 24px;
  position: relative;
}

/* 笔记本底部波浪线 */
.nb-wave {
  position: absolute;
  bottom: 6px;
  left: 24px;
  right: 24px;
  height: 8px;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0, transparent 6px,
    var(--ld-yellow) 6px, var(--ld-yellow) 8px,
    transparent 8px, transparent 14px,
    var(--ld-blue) 14px, var(--ld-blue) 16px,
    transparent 16px, transparent 22px,
    var(--ld-pink) 22px, var(--ld-pink) 24px
  );
  opacity: .6;
}

/* ============================================================
 * 页面1：全部任务清单
 * ============================================================ */
.list-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* 左侧筛选栏 */
.sidebar-filter {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 30px;
  min-width: 100px;
}
.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-family: var(--font-title);
  font-size: 17px;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--card-bg);
  transition: all .15s;
  white-space: nowrap;
}
.filter-item:hover { background: var(--time-bg); }
.filter-item.active {
  background: var(--ink);
  color: #fff;
}
.filter-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ld-yellow);
}
.filter-item.active .filter-dot { display: block; }

/* 主卡片 */
.notebook > .nb-body { min-height: 420px; }

/* 顶部彩色方块 */
.top-blocks {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.tb {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px solid var(--ink);
}
.tb-1 { background: var(--ld-yellow); }
.tb-2 { background: var(--ld-blue); }
.tb-3 { background: var(--ld-pink); }

/* 右上角星星 */
.nb-deco-star {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  transform: rotate(15deg);
}

/* 分类标签 */
.cat-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cat-tab {
  padding: 5px 16px;
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  transition: all .15s;
}
.cat-tab:hover { background: var(--time-bg); }
.cat-tab.active {
  background: var(--hl);
  border-color: var(--ink);
}

/* "今天"分隔标签行 */
.list-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 4px;
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-light);
}
.ls-flower { color: var(--ld-pink); font-size: 18px; }
.ls-duck { font-size: 18px; margin-left: 2px; }

/* ============================================================
 * 任务行通用
 * ============================================================ */
.task-list { display: flex; flex-direction: column; gap: 2px; }

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px dashed var(--grid);
  position: relative;
  transition: background .15s;
  cursor: pointer;
}
.task-row:hover { background: var(--time-bg); }
.task-row:last-child { border-bottom: none; }

/* checkbox 圆圈 */
.task-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  font-size: 13px;
  color: transparent;
  transition: all .15s;
}
.task-check:hover { border-color: var(--check); }
.task-row.checked .task-check {
  background: var(--check);
  border-color: var(--check);
  color: #fff;
}
.task-row.checked .task-check::after {
  content: '✓';
  color: #fff;
  font-size: 13px;
  font-weight: bold;
}

/* 任务标题 */
.task-title {
  flex: 1;
  font-size: 17px;
  color: var(--ink);
  line-height: 1.4;
}
.task-row.checked .task-title {
  text-decoration: line-through;
  color: #999;
}

/* 时间胶囊 */
.task-time {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink);
  background: var(--time-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* 编辑按钮 */
.task-edit-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--ink-light);
  border-radius: 50%;
  opacity: 0;
  transition: opacity .15s;
}
.task-row:hover .task-edit-btn { opacity: .5; }
.task-edit-btn:hover { opacity: 1 !important; background: var(--hl); }

/* featured 行（今天标签） */
.task-row.featured {
  background: var(--time-bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
  padding: 12px 10px;
  margin: 4px 0 8px;
  flex-wrap: wrap;
}
.task-row.featured .featured-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.task-row.featured .featured-tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-light);
}
.task-row.featured .featured-flower { color: var(--ld-pink); font-size: 18px; }
.task-row.featured .featured-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.task-row.featured .featured-stickers {
  position: absolute;
  top: 8px;
  right: 14px;
  display: flex;
  gap: 4px;
  font-size: 22px;
  filter: drop-shadow(1px 1px 0 var(--ink));
  pointer-events: none;
}

/* "完成"标签 */
.done-label {
  position: absolute;
  bottom: 18px;
  right: 24px;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink-light);
  opacity: .4;
}

/* ============================================================
 * 页面2：四象限
 * ============================================================ */
.quad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.nb-quad { min-height: 280px; }
.nb-quad .nb-body { padding: 16px 18px 20px; min-height: 240px; }

.quad-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.quad-title {
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--ink);
}
.quad-emoji { font-size: 22px; }
.deco-line {
  display: inline-block;
  width: 22px;
  height: 4px;
  border-radius: 2px;
}
.dl-yellow { background: var(--ld-yellow); }
.dl-pink   { background: var(--ld-pink); }
.dl-blue   { background: var(--ld-blue); }

.quad-today {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink-light);
}
.quad-flower { color: var(--ld-pink); font-size: 16px; }
.quad-duck { font-size: 18px; }

.quad-task-list { gap: 0; }
.quad-task-list .task-row { padding: 6px 4px; }
.quad-task-list .task-title { font-size: 15px; }
.quad-task-list .task-time { font-size: 12px; padding: 2px 8px; }

.quad-foot {
  position: absolute;
  bottom: 14px;
  right: 18px;
}
.complete-btn {
  padding: 4px 14px;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--check);
  border: 1.5px solid var(--check);
  border-radius: var(--radius-pill);
  background: transparent;
  transition: all .15s;
}
.complete-btn:hover { background: var(--check); color: #fff; }

/* ============================================================
 * 页面3：好习惯打卡
 * ============================================================ */
.habits-wrap { max-width: 600px; margin: 0 auto; }
.nb-habits .nb-body { min-height: 400px; padding: 20px 28px 28px; }

.habits-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.habits-sun { font-size: 30px; }
.habits-title {
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--ink);
}
.habits-deco-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hd-duck { font-size: 24px; }
.hd-sparkle { font-size: 18px; }
.hd-star { font-size: 20px; color: var(--ld-yellow); }

.habits-list .task-row {
  padding: 12px 10px;
  border-bottom: 1.5px dashed var(--grid);
}
.habits-list .task-title { font-size: 18px; }
.habits-time {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink-light);
  margin-left: 4px;
}
.habits-emoji {
  font-size: 26px;
  margin-left: auto;
  min-width: 30px;
  text-align: center;
}
.task-row.checked .habits-emoji {
  opacity: .4;
}

.habits-foot {
  text-align: center;
  margin-top: 20px;
  padding-bottom: 10px;
}
.add-habit-btn {
  padding: 8px 32px;
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--card-bg);
  transition: all .15s;
}
.add-habit-btn:hover { background: var(--hl); }

/* ============================================================
 * 页面4：月历
 * ============================================================ */
.cal-wrap { max-width: 800px; margin: 0 auto; }
.nb-cal .nb-body { padding: 20px 24px 28px; }

.cal-top-deco {
  position: absolute;
  top: 14px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 24px;
  z-index: 3;
}
.cal-top-right {
  left: auto;
  right: 20px;
}
.cal-star1, .cal-star2 { font-size: 20px; color: var(--ld-yellow); }
.cal-sparkle { font-size: 16px; }

.cal-title {
  text-align: center;
  font-family: var(--font-title);
  font-size: 26px;
  color: var(--ink);
  margin-bottom: 12px;
}

.cal-toolbar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.cal-nav-btn {
  padding: 4px 16px;
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  transition: all .15s;
}
.cal-nav-btn:hover { background: var(--time-bg); }

.cal-weekheader {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 6px;
}
.wh {
  font-family: var(--font-title);
  font-size: 16px;
  color: var(--ink);
  padding: 6px 0;
}
.wh-sun { color: #D44; }
.wh-sat { color: #44D; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  min-height: 64px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 5px;
  background: var(--card-bg);
  position: relative;
  cursor: pointer;
  transition: all .15s;
}
.cal-cell:hover { border-color: var(--ink); background: var(--time-bg); }
.cal-cell.empty { border: none; background: transparent; cursor: default; }
.cal-cell.empty:hover { background: transparent; }
.cal-cell.sun { background: #FFF5F5; }
.cal-cell.sat { background: #F5F8FF; }
.cal-cell.today {
  background: var(--hl);
  border-color: var(--ink);
  border-width: 2px;
}

.cal-cell-num {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cal-cell.sun .cal-cell-num { color: #D44; }
.cal-cell.sat .cal-cell-num { color: #44D; }
.cal-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--check);
}

.cal-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-light);
  line-height: 1.3;
  padding: 1px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cal-item .cal-mark { color: var(--check); font-weight: bold; flex-shrink: 0; }
.cal-item.done { text-decoration: line-through; opacity: .6; }

.cal-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 0 4px;
}
.emoji-row { display: flex; gap: 8px; }
.emoji-btn {
  font-size: 26px;
  cursor: pointer;
  transition: transform .15s;
}
.emoji-btn:hover { transform: scale(1.2); }
.cal-pencil { font-size: 24px; transform: rotate(-15deg); }

/* ============================================================
 * FAB 浮动添加
 * ============================================================ */
.fab-add {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 56px;
  height: 56px;
  font-size: 30px;
  color: #fff;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 3px 8px rgba(0,0,0,.2);
  z-index: 90;
  transition: transform .15s;
}
.fab-add:hover { transform: scale(1.08) rotate(90deg); }

/* ============================================================
 * 弹窗
 * ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(34,34,34,.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-card {
  width: 100%;
  max-width: 460px;
  margin-top: 10px;
}
.modal-card .nb-body { padding: 24px 28px 28px; }

.modal-title {
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 18px;
  text-align: center;
}

.modal-form { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--ink-light);
}
.form-input {
  padding: 8px 12px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
}
.form-input:focus { border-color: var(--check); box-shadow: 0 0 0 2px rgba(112,184,115,.2); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
.btn-ghost {
  padding: 8px 20px;
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  transition: all .15s;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary {
  padding: 8px 24px;
  font-family: var(--font-title);
  font-size: 15px;
  color: #fff;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--ink);
  transition: all .15s;
}
.btn-primary:hover { background: #000; }

/* ============================================================
 * Toast
 * ============================================================ */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 28px;
  font-family: var(--font-title);
  font-size: 15px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius-pill);
  opacity: 0;
  pointer-events: none;
  transition: all .3s;
  z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
 * 空状态
 * ============================================================ */
.empty-tip {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-light);
  opacity: .6;
  line-height: 2;
}

/* ============================================================
 * 响应式
 * ============================================================ */
@media (max-width: 768px) {
  .list-layout { flex-direction: column; }
  .sidebar-filter { flex-direction: row; flex-wrap: wrap; padding-top: 0; }
  .quad-grid { grid-template-columns: 1fr; }
  .nav-tab span:not(.nav-tab-emoji) { display: none; }
  .cal-cell { min-height: 48px; }
  .cal-item { font-size: 9px; }
}
