/* ==========================================================================
   notes.css · 笔记与待办页（notes.html，升级项 08a）
   宽屏左列表右编辑；900px 以下上下排列。只用 tokens.css 的令牌。
   ========================================================================== */
.notes {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}
@media (max-width: 900px) { .notes { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 左侧：搜索、新建、列表 ---------- */
.notes__side { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; padding: var(--space-3); }
.notes__toolbar { display: flex; align-items: center; gap: var(--space-2); }
.notes__search {
  display: flex; flex: 1; align-items: center; gap: var(--space-2); min-width: 0;
  min-height: 36px; padding-inline: var(--space-3);
  background: var(--surface-strong); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.notes__search:focus-within { border-color: var(--accent); }
.notes__search .icon { width: 15px; height: 15px; flex: none; color: var(--text-faint); }
.notes__search input {
  flex: 1; min-width: 0; padding-block: 0.5em;
  font: inherit; font-size: var(--text-sm); color: var(--text);
  background: none; border: 0; outline: none; appearance: none; -webkit-appearance: none;
}
.notes__search input::placeholder { color: var(--text-faint); }
.notes__search input::-webkit-search-cancel-button { display: none; }
.notes__count { margin: 0; min-height: 1.2em; font-size: var(--text-xs); color: var(--text-muted); }

.notes__list {
  display: grid; gap: 2px;
  max-height: min(60vh, 560px); margin: 0; padding: 0; overflow-y: auto; list-style: none;
}
@media (max-width: 900px) { .notes__list { max-height: 40vh; } }
.notes__item {
  display: grid; gap: 2px; width: 100%;
  padding: var(--space-2) var(--space-3);
  font: inherit; text-align: start; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-md);
  cursor: pointer;
}
.notes__item:hover { background: var(--surface-hover); }
.notes__item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.notes__item[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent-line); }
.notes__item-head { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.notes__item-pin { width: 13px; height: 13px; flex: none; color: var(--accent); }
.notes__item-title {
  overflow: hidden; font-size: var(--text-sm); font-weight: 600;
  text-overflow: ellipsis; white-space: nowrap;
}
.notes__item-snippet {
  overflow: hidden; font-size: var(--text-xs); color: var(--text-muted);
  text-overflow: ellipsis; white-space: nowrap;
}
.notes__item-time { font-size: var(--text-xs); color: var(--text-faint); }
.notes__none { padding: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }

/* ---------- 右侧：编辑框 ---------- */
.notes__editor { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; padding: var(--space-3); }
.notes__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: 34px; }
.notes__status { margin-inline-end: auto; font-size: var(--text-xs); color: var(--text-muted); }
.notes__status.is-error { color: var(--danger); font-weight: 600; }
.notes__bar .btn[aria-pressed="true"] { color: var(--accent); }
.notes__bar .btn:disabled { opacity: 0.45; cursor: default; }
.notes__text {
  min-height: min(60vh, 560px);
  font-size: var(--text-base);
  line-height: 1.75;
  resize: vertical;
}
@media (max-width: 900px) { .notes__text { min-height: 45vh; } }
.notes__empty {
  display: grid; place-items: center; min-height: 240px; margin: 0;
  font-size: var(--text-sm); color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
}

/* ---------- 撤销删除 ---------- */
.notes__undo {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin-top: var(--space-3); padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
}

/* ======================================================================
   待办（08b）
   ====================================================================== */
.notes-panel[hidden] { display: none; }
.todos { display: grid; gap: var(--space-3); padding: var(--space-4); }

.todo-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.todo-form__text { flex: 1 1 260px; min-width: 0; }
.todo-form__priority { flex: 0 0 auto; width: auto; }
.todo-form__due { flex: 0 0 auto; width: auto; }
.todo-status { margin: 0; min-height: 1.2em; font-size: var(--text-xs); color: var(--text-muted); }
.todo-status.is-error { color: var(--danger); font-weight: 600; }

.todo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.todo-filters { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.todo-filters .btn[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); border-color: var(--accent-line); }
.todo-count { margin-inline-end: auto; font-size: var(--text-xs); color: var(--text-muted); }
.todo-bar .btn:disabled { opacity: 0.45; cursor: default; }
.todo-hint { margin: 0; font-size: var(--text-xs); color: var(--text-faint); }

.todo-list { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.todo-item {
  display: flex; align-items: center; gap: var(--space-2);
  min-width: 0; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.todo-item .sortable-handle { margin-inline-start: calc(var(--space-2) * -1); }
/* 重要：左侧一道强调色（用内阴影，不改边框宽度，各行的手柄与勾选框才对得齐） */
.todo-item.is-high { box-shadow: inset 3px 0 0 var(--accent); }
.todo-item.is-grabbed { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.todo-item.is-high.is-grabbed { box-shadow: inset 3px 0 0 var(--accent), 0 0 0 1px var(--accent-line); }
.todo-item.is-dragging { position: relative; z-index: 5; background: var(--bg-elev); border-color: var(--accent-line); box-shadow: var(--shadow-lg); }
.todo-item__check { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent-solid); cursor: pointer; }
.todo-item__body { display: grid; flex: 1; gap: 2px; min-width: 0; }
.todo-item__text {
  padding: 2px 0; overflow-wrap: anywhere;
  font: inherit; font-size: var(--text-sm); text-align: start; color: var(--text);
  background: none; border: 0; cursor: text;
}
.todo-item__text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
.todo-item.is-done .todo-item__text { color: var(--text-faint); text-decoration: line-through; }
.todo-item__edit { min-height: 34px; padding-block: 0.35em; font-size: var(--text-sm); }
.todo-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-xs); }
.todo-item__priority--high { color: var(--accent); }
.todo-item__priority--low { color: var(--text-muted); }
.todo-item__due { color: var(--text-muted); }
.todo-item__due--today { color: var(--accent); font-weight: 600; }
.todo-item__due--soon { color: var(--warning); }
.todo-item__due--overdue { color: var(--danger); font-weight: 600; }
.todo-item .todo-item__delete { flex: none; width: 34px; min-height: 34px; color: var(--text-faint); }
.todo-item .todo-item__delete:hover { color: var(--danger); }
.todo-item .todo-item__delete .icon { width: 16px; height: 16px; }
@media (pointer: coarse) {
  .todo-item .todo-item__delete { width: 44px; min-height: 44px; }
  .todo-item__check { width: 22px; height: 22px; }
}
.todo-empty {
  padding: var(--space-4); font-size: var(--text-sm); color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
}
