/* todo — the ToDo page (js/todo.js): a project's document list beside the open document.
 * The rendered Markdown itself is styled by markdown.css; phone stacking is in mobile.css. */

.td-project-pick select { min-width: 220px; max-width: 360px; }

/* · the page never scrolls as a whole: the document list and the open document each scroll
 *   inside their own box, so the header, the project picker and Refresh stay in reach */
#workspace-page:has(> #td-layout) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 20px;
}
#workspace-page:has(> #td-layout) > :not(#td-layout) { flex: none; }

.td-refresh.is-spinning svg { animation: td-spin 0.8s linear infinite; }
@keyframes td-spin { to { transform: rotate(360deg); } }

.td-note-ro {
  padding: 9px 12px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r-md);
  background: var(--warn-dim);
  color: var(--warn);
}

.td-layout {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
}

.td-list,
.td-doc {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-card);
}

.td-list,
.td-doc {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.td-list { padding: 12px 8px 8px; }
.td-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 10px;
}
.td-list-head h3 { font-size: var(--font-size-md); font-weight: 650; color: var(--text); }

.td-docs {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  gap: 2px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.td-docs .ws-empty,
.td-docs .ws-loading { padding: 12px 6px; }

.td-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: var(--r-md);
}
.td-item:hover { background: var(--bg-hover); }
.td-item.is-active { background: var(--accent-dim); }

.td-open {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 2px 4px;
  border-radius: var(--r-sm);
  text-align: left;
}
.td-item-title {
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-item.is-active .td-item-title { color: var(--accent-2); }
.td-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--text-3);
  font-size: var(--font-size-xs);
}
.td-counts { color: var(--text-2); }
.td-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.td-item:hover .td-item-actions,
.td-item:focus-within .td-item-actions,
.td-item.is-active .td-item-actions { opacity: 1; }

.td-doc { padding: 16px 18px 18px; }
.td-doc-empty { padding: 8px 0; }
.td-doc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.td-doc-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: var(--font-size-lg);
  font-weight: 680;
}
.td-save { color: var(--text-3); font-size: var(--font-size-xs); }
.td-doc-tools { display: flex; gap: 4px; }
.td-save[data-state="saved"] { color: var(--ok); }
.td-save[data-state="error"] { color: var(--danger); }
.td-doc-meta { margin: 4px 0 12px; color: var(--text-3); font-size: var(--font-size-xs); }

.td-doc-body {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -6px;
  padding: 0 6px 24px;
  overflow-y: auto;
}

.md-doc { min-height: 100%; color: var(--text); font-size: var(--font-size-base); }
.td-empty-doc { cursor: text; }

.td-hint { flex: none; margin-top: 8px; color: var(--text-3); font-size: var(--font-size-xs); }
.td-hint code,
.todo-conflict-text { font-family: var(--font-mono); }

.todo-conflict-text { min-height: 140px; margin-top: 4px; font-size: var(--font-size-sm); }
