/* ===== Todo-модуль — общие стили (веб + side panel расширения).
   Опирается на CSS-переменные палитры (--surface, --line, --ink…), объявленные хостом.
   Копия для расширения: extension/todo-ui.css — синхронизировать при правках. ===== */

.todo { display: flex; flex-direction: column; gap: var(--s3, 12px); }

/* добавление */
.todo-add { display: flex; gap: 8px; }
.todo-add-input { flex: 1; min-width: 0; }
.todo-add-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; }

/* вкладки — используем .seg хоста, добавляем счётчики */
.todo-tabs { align-self: flex-start; }

/* список */
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.todo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px; border-bottom: 1px solid var(--line-2, var(--line));
  cursor: pointer; border-radius: 8px;
  transition: background .12s;
}
.todo-item { user-select: none; }
.todo-item:hover { background: var(--surface-2); }
.todo-item.is-selected { background: var(--surface-2); }
.todo-item.is-selected .todo-act { opacity: 1; }
/* первый пункт активных — текущий фокус: терракотовая метка слева и тёплая подложка */
.todo-item.is-focus {
  background: color-mix(in srgb, var(--accent, #B57F66) 9%, transparent);
  box-shadow: inset 3px 0 0 var(--accent, #B57F66);
}
.todo-item.is-focus:hover,
.todo-item.is-focus.is-selected { background: color-mix(in srgb, var(--accent, #B57F66) 14%, transparent); }
.todo-item.is-focus .todo-title { font-weight: 500; }
/* тащимый пункт превращается в явный «слот» — видно, куда встанет */
.todo-item.dragging {
  background: var(--surface-2);
  outline: 1.5px dashed var(--ink-3); outline-offset: -1.5px;
  border-bottom-color: transparent;
}
.todo-item.dragging > * { opacity: .3; }
.todo-item:last-child { border-bottom: none; }

.todo-grip { color: var(--ink-3); cursor: grab; display: inline-flex; flex: 0 0 auto; }
.todo-grip:active { cursor: grabbing; }

.todo-check {
  flex: 0 0 auto; width: 20px; height: 20px; padding: 0;
  border: 1.5px solid var(--ink-3); border-radius: 50%;
  background: transparent; color: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s, color .15s;
}
.todo-check:hover { border-color: var(--ink); }
.todo-check.is-on { border-color: var(--ink-3); background: var(--surface-2); color: var(--ink-2); cursor: default; }
.todo-check.is-on .ic { width: 12px; height: 12px; }

.todo-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item.is-done .todo-title { text-decoration: line-through; color: var(--ink-3); }
.todo-item.is-archived .todo-title { color: var(--ink-3); }

.todo-time {
  flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.todo-note-ic { flex: 0 0 auto; display: inline-flex; color: var(--ink-3); }
.todo-note-ic .ic { width: 13px; height: 13px; }

.todo-done-at {
  flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.todo-rename { padding: 5px 9px; font-size: inherit; }

.todo-act {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: none; border-radius: 7px; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background .12s, color .12s;
  opacity: 0;
}
.todo-item:hover .todo-act, .todo-act:focus-visible { opacity: 1; }
.todo-act:hover { background: var(--surface-2); color: var(--ink); }

.todo-empty { padding: 14px 4px; color: var(--ink-3); font-size: 13px; }

/* ===== заметка — карточка под списком, список остаётся видимым ===== */
.todo-note {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 4px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm, 10px);
  background: var(--surface);
}
.note-head { display: flex; align-items: center; gap: 8px; }
.note-head .todo-act { opacity: 1; }
.note-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-vbtn { width: auto !important; padding: 0 8px !important; gap: 5px; }
.note-vnum { font-size: 11.5px; font-variant-numeric: tabular-nums; }

.note-text {
  width: 100%; min-height: 220px; resize: vertical;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm, 10px);
  background: var(--surface); color: var(--ink);
  font: inherit; line-height: 1.55; letter-spacing: inherit;
}
.note-text:focus { outline: none; border-color: var(--ink-3); }
.note-text[readonly] { background: var(--surface-2); color: var(--ink-2); }

.note-status { font-size: 12px; color: var(--ink-3); min-height: 16px; }
.note-bar { display: flex; gap: 8px; }

.note-versions { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm, 10px); overflow: hidden; }
.note-ver {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 8px 12px; border: none; border-bottom: 1px solid var(--line-2, var(--line));
  background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: background .12s;
}
.note-ver:last-child { border-bottom: none; }
.note-ver:hover { background: var(--surface-2); }
.note-ver-date { flex: 0 0 auto; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.note-ver-snip { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-ver-empty { padding: 10px 12px; font-size: 12.5px; color: var(--ink-3); }
