:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #8a93a3;
  --line: #e7eaf0;
  --brand: #3b6cff;
  --brand-soft: #eaf0ff;
  --done: #b6bdca;
  --shadow: 0 1px 3px rgba(20, 30, 60, 0.06), 0 8px 24px rgba(20, 30, 60, 0.05);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 20px 64px; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 24px; letter-spacing: .5px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stats { display: flex; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }

.add { margin-top: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.add-row input { flex: 1 1 160px; min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fbfcfe; color: var(--ink); }
.add-row input:focus { outline: none; border-color: var(--brand); background: #fff; }
#catInput { flex: 1 1 220px; }
#addBtn { flex: 0 0 auto; padding: 11px 20px; border: none; border-radius: 10px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
#addBtn:hover { filter: brightness(1.05); }

.chips { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fbfcfe; color: var(--muted); cursor: pointer; }
.chip:hover { border-color: var(--brand); color: var(--brand); }

.head-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.add-open { padding: 10px 18px; border: none; border-radius: 10px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); }
.add-open:hover { filter: brightness(1.05); }

/* 添加备忘弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 30, 60, 0.35); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-mask[hidden] { display: none; }
.modal { width: 100%; max-width: 520px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(20, 30, 60, 0.25); padding: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head strong { font-size: 16px; }
.modal-x { border: none; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.modal-x:hover { background: #f1f3f8; color: var(--ink); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.btn-ghost { padding: 11px 20px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-size: 14px; cursor: pointer; }
.btn-ghost:hover { background: #f3f4f8; }

/* tabs */
.tabs-wrap { position: relative; margin-top: 20px; display: flex; align-items: flex-start; gap: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; align-content: flex-start; }
.tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--card); cursor: pointer; font-size: 14px; white-space: nowrap;
  box-shadow: var(--shadow); border-left: 4px solid transparent;
}
.tab:hover { border-color: #c9d3e6; }
.tab[draggable=true] { cursor: grab; }
.tab.dragging { opacity: .4; }
.tab.over { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.tab .tdot { width: 9px; height: 9px; border-radius: 50%; }
.tab .tname { font-weight: 600; }
.tab .tcount { font-size: 12px; font-weight: 600; color: var(--muted); background: #f0f2f7; padding: 1px 8px; border-radius: 999px; }
.tab.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.tab.active .tcount { background: #fff; color: var(--brand); }

.more { position: relative; flex: 0 0 auto; }
.more-btn { height: 100%; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); cursor: pointer; font-size: 13px; color: var(--ink); box-shadow: var(--shadow); }
.more-btn:hover { border-color: #c9d3e6; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px; max-height: 320px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.more-menu .mi { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.more-menu .mi:hover { background: #f4f6fb; }
.more-menu .mi .mc { font-size: 12px; font-weight: 600; color: var(--muted); background: #f0f2f7; padding: 1px 8px; border-radius: 999px; }
.more-menu .mi.active { color: var(--brand); font-weight: 600; }

.panel-toolbar { margin: 14px 2px 8px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.hide-done { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hint { font-size: 12px; }

/* panel */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.panel-head .pdot { width: 10px; height: 10px; border-radius: 50%; }
.panel-head .ptitle { font-weight: 600; font-size: 15px; }
.panel-head .pcount { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.items { list-style: none; margin: 0; padding: 6px 8px; }
.item { display: flex; align-items: flex-start; gap: 11px; padding: 10px 8px; border-radius: 10px; border-left: 4px solid transparent; }
.item.done { opacity: .75; }
.item:hover { background: #fafbfe; }
.item input[type=checkbox] { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.item .txt { flex: 1; font-size: 14px; word-break: break-word; }
.item .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.item.done .txt { text-decoration: line-through; color: var(--done); }
.del { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 8px; }
.del:hover { background: #ffecec; color: #e5484d; }
.ops { display: flex; align-items: center; gap: 2px; }
.edit { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 3px 7px; border-radius: 8px; }
.edit:hover { background: #eef2ff; color: var(--brand); }
/* 内联编辑表单 */
.item.editing { background: #f6f8ff; }
.edit-form { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.edit-form .e-cat { width: 200px; padding: 6px 9px; border: 1px solid #c9d3e6; border-radius: 8px; font-size: 13px; }
.edit-form .e-text { width: 100%; padding: 7px 9px; border: 1px solid #c9d3e6; border-radius: 8px; font-size: 14px; resize: vertical; font-family: inherit; }
.edit-form .e-cat:focus, .edit-form .e-text:focus { outline: none; border-color: var(--brand); }
.edit-actions { display: flex; gap: 8px; }
.e-save, .e-cancel { border: 1px solid transparent; border-radius: 8px; padding: 6px 16px; font-size: 13px; cursor: pointer; }
.e-save { background: var(--brand); color: #fff; }
.e-save:hover { background: #2f59d6; }
.e-cancel { background: #fff; border-color: #c9d3e6; color: var(--muted); }
.e-cancel:hover { background: #f3f4f8; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* 优先级徽标 */
.prio { display: inline-block; font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px; color: #fff; font-weight: 600; vertical-align: middle; margin-left: 6px; }

/* 行内快捷标记按钮（重要/紧急，点击切换/取消） */
.pbtn { border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; font-size: 12px; line-height: 1; padding: 4px 9px; border-radius: 999px; flex: 0 0 auto; }
.pbtn.mid:hover { border-color: #f59e0b; color: #b45309; background: #fff7e8; }
.pbtn.high:hover { border-color: #e5484d; color: #e5484d; background: #ffecec; }
.pbtn.mid.on { background: #f59e0b; border-color: #f59e0b; color: #fff; font-weight: 600; }
.pbtn.high.on { background: #e5484d; border-color: #e5484d; color: #fff; font-weight: 600; }

/* 标签上的紧急/重要角标（红=有紧急，橙=仅重要，数字为条数） */
.tab { position: relative; }
.pdot-badge { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(20,30,60,.25); }
.pdot-badge.high { background: #e5484d; }
.pdot-badge.mid { background: #f59e0b; }
.mi-flag { font-size: 11px; margin-left: 6px; font-weight: 600; }
.mi-flag.high { color: #e5484d; }
.mi-flag.mid { color: #b45309; }

/* 标签删除按钮（仅当该地点全部完成时出现） */
.tab-del { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 6px; flex: 0 0 auto; }
.tab-del:hover { background: #ffecec; color: #e5484d; }
.mi-del { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 6px; border-radius: 6px; flex: 0 0 auto; }
.mi-del:hover { background: #ffecec; color: #e5484d; }
