/* notes.css — personal notes + to-do view. Scoped under .notes-* /
   .note-* / .todo-* so it can't bleed into any other surface. */

.notes-root {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg-app); min-height: 0;
  overflow: auto;
}

.notes-header {
  flex-shrink: 0;
  padding: 22px 28px 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-row);
}
.notes-title-row {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.notes-title {
  font-size: 22px; font-weight: 800; color: var(--ink-strong);
  margin: 0; display: inline-flex; align-items: center; gap: 8px;
}
.notes-title-icon { font-size: 20px; }
.notes-meta { font-size: 12.5px; color: var(--ink-muted); }

.notes-tabs {
  display: flex; gap: 2px;
}
.notes-tab {
  padding: 10px 18px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--ink-muted);
  background: transparent;
  border: none; border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color .12s ease, border-color .12s ease;
}
.notes-tab:hover { color: var(--ink-body); }
.notes-tab.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.notes-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: 999px;
  background: var(--bg-subtle);
  font-size: 10.5px; font-weight: 800;
  color: var(--ink-muted);
}
.notes-tab.is-active .notes-tab-count {
  background: var(--brand-soft, rgba(108,43,217,.10));
  color: var(--brand);
}

.notes-error {
  margin: 14px 28px 0;
  padding: 10px 14px;
  background: rgba(228,68,92,.06);
  border: 1px solid rgba(228,68,92,.28);
  color: #b41f37; border-radius: var(--r-md);
  font-size: 13px;
}

.notes-empty {
  padding: 60px 28px;
  text-align: center; color: var(--ink-muted);
  font-size: 13.5px;
  margin-top: 14px;
}

/* ── Notes grid ─────────────────────────────────────────────────────── */
.notes-grid-wrap {
  padding: 18px 28px 40px;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.notes-add-card {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 340px;
  padding: 12px 16px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--ink-muted);
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.notes-add-card:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft, rgba(108,43,217,.06));
}
.notes-add-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--bg-subtle); border-radius: 999px;
  font-weight: 800; font-size: 14px;
}

.note-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-row);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  transition: box-shadow .12s ease, border-color .12s ease, transform .12s ease;
  min-height: 110px;
}
.note-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 14px rgba(16,22,40,.06);
  transform: translateY(-1px);
}
.note-card.is-pinned {
  border-color: rgba(253,171,61,.55);
  box-shadow: 0 0 0 1px rgba(253,171,61,.32) inset;
}
.note-card.is-editing {
  cursor: default;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft, rgba(108,43,217,.12));
}
.note-card-head {
  display: flex; align-items: center; gap: 6px;
}
.note-pin-mark { font-size: 12px; }
.note-card-title {
  font-weight: 700; color: var(--ink-strong); font-size: 14px;
  flex: 1; word-break: break-word;
}
.note-card-untitled { color: var(--ink-faint); font-style: italic; font-weight: 500; }
.note-card-body {
  font-size: 13px; color: var(--ink-body); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.note-card-foot {
  display: flex; gap: 8px; margin-top: auto;
  border-top: 1px dashed var(--border-row);
  padding-top: 8px;
  opacity: 0;
  transition: opacity .12s ease;
}
.note-card:hover .note-card-foot,
.note-card.is-pinned .note-card-foot { opacity: 1; }
.note-card-action {
  font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid transparent;
  padding: 3px 8px; border-radius: 4px;
  cursor: pointer;
}
.note-card-action:hover {
  color: var(--ink-strong); border-color: var(--border-soft);
  background: var(--bg-subtle);
}
.note-card-action.danger:hover {
  color: #c0223a; border-color: #f5c0cc; background: #fff0f3;
}

/* Edit form */
.note-edit-title {
  width: 100%;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-strong);
  border: none; background: transparent;
  padding: 0;
}
.note-edit-title:focus { outline: none; }
.note-edit-body {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 13px; color: var(--ink-body);
  border: none; background: transparent;
  resize: vertical; min-height: 80px;
  padding: 0;
}
.note-edit-body:focus { outline: none; }
.note-edit-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
  border-top: 1px dashed var(--border-row);
  padding-top: 8px;
}
.note-color-btn,
.note-pin-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.note-color-btn:hover,
.note-pin-btn:hover { background: var(--bg-subtle); }
.note-pin-btn.is-on { background: rgba(253,171,61,.16); border-color: rgba(253,171,61,.42); }
.note-color-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.08);
}
.note-color-swatch-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  border-radius: 6px; cursor: pointer;
}
.note-color-swatch-btn:hover { border-color: var(--border-strong); background: var(--bg-subtle); }

/* ── To-do list ─────────────────────────────────────────────────────── */
.todo-wrap {
  padding: 18px 28px 40px;
  max-width: 720px;
}
.todo-add {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-row);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.todo-add:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft, rgba(108,43,217,.12));
}
.todo-add-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  background: var(--bg-subtle); color: var(--ink-muted);
  border-radius: 999px; font-weight: 800;
}
.todo-add-input {
  flex: 1;
  font: inherit; font-size: 14px;
  border: none; background: transparent; outline: none;
  color: var(--ink-strong);
}
.todo-add-input::placeholder { color: var(--ink-faint); }

.todo-list {
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-row);
  border-radius: var(--r-md);
  overflow: hidden;
}
.todo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-row);
  transition: background .1s ease;
}
.todo-row:last-child { border-bottom: none; }
.todo-row:hover { background: var(--bg-app); }

.todo-check {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: white;
  cursor: pointer;
  font-weight: 800; color: white; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .1s ease;
}
.todo-check:hover { border-color: var(--brand); }
.todo-row.is-done .todo-check {
  background: var(--brand);
  border-color: var(--brand);
}
.todo-text {
  flex: 1;
  font-size: 14px; color: var(--ink-strong);
  cursor: text;
  word-break: break-word;
}
.todo-row.is-done .todo-text {
  text-decoration: line-through;
  color: var(--ink-muted);
}
.todo-untitled { color: var(--ink-faint); font-style: italic; }
.todo-edit-input {
  flex: 1;
  font: inherit; font-size: 14px; color: var(--ink-strong);
  border: none; background: transparent; outline: none;
  border-bottom: 1px solid var(--brand);
  padding-bottom: 2px;
}
.todo-remove {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: transparent; border: 1px solid transparent;
  border-radius: 4px; cursor: pointer;
  color: var(--ink-faint);
  opacity: 0; transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.todo-row:hover .todo-remove { opacity: 1; }
.todo-remove:hover {
  background: #fff0f3; color: #c0223a; border-color: #f5c0cc;
}

/* ── Schedule UI for personal todos ─────────────────────────── */
/* Button on the +Add row to open the date/time picker. Compact —
   shows just the calendar emoji when nothing's picked, expands to
   include the chosen text once a date is set. */
.todo-sched-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  font: inherit; font-size: 12px; font-weight: 600;
  background: transparent; border: 1px dashed #d1d5dc;
  color: #676879; cursor: pointer; flex-shrink: 0;
  transition: background .1s, border-color .1s, color .1s;
}
.todo-sched-btn:hover { background: #f5f6f8; border-color: #b6bccb; color: #323338; }
.todo-sched-btn.is-set {
  background: rgba(0, 115, 234, .08);
  border: 1px solid rgba(0, 115, 234, .35);
  border-style: solid;
  color: #0060b9;
}
.todo-sched-chip-text { font-variant-numeric: tabular-nums; }

/* Existing-row variants. The chip shows the saved date/time, the
   small "add" button replaces it on rows with no date set (only
   visible on row hover so idle rows stay clean). */
.todo-sched-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 999px;
  font: inherit; font-size: 11.5px; font-weight: 600;
  background: rgba(0, 115, 234, .08);
  border: 1px solid rgba(0, 115, 234, .25);
  color: #0060b9;
  cursor: pointer; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.todo-sched-chip:hover { background: rgba(0, 115, 234, .14); }
.todo-row.is-done .todo-sched-chip {
  background: #f5f6f8; border-color: #e6e9ef; color: #a3a8b6;
}
.todo-sched-add {
  background: transparent; border: 0; padding: 4px 6px;
  border-radius: 6px; cursor: pointer;
  font-size: 13px; line-height: 1;
  color: #a3a8b6;
  opacity: 0; transition: opacity .12s, background .12s;
  flex-shrink: 0;
}
.todo-row:hover .todo-sched-add { opacity: 1; }
.todo-sched-add:hover { background: #f5f6f8; color: #0073ea; }

/* Popover housing the native datetime-local picker. Positioned via
   inline `position: fixed` from the JS so it isn't clipped by the
   list's own scroll. z-index 10100 lines up with the rest of the
   popover layer (above modals). */
.todo-sched-pop {
  position: fixed; z-index: 10100;
  background: white; border: 1px solid #e6e9ef; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 41, .18);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 240px;
  animation: todoSchedFadeIn .12s ease-out;
}
@keyframes todoSchedFadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.todo-sched-input {
  font: inherit; font-size: 13px;
  padding: 8px 10px;
  border: 1.5px solid #e6e9ef; border-radius: 7px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.todo-sched-input:focus {
  border-color: #0073ea;
  box-shadow: 0 0 0 3px rgba(0, 115, 234, .12);
}
.todo-sched-actions {
  display: flex; gap: 6px; justify-content: flex-end;
}
.todo-sched-clear, .todo-sched-save {
  padding: 6px 12px; border-radius: 6px;
  font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.todo-sched-clear { background: white; color: #c0223a; border-color: rgba(228, 68, 92, .25); }
.todo-sched-clear:hover { background: rgba(228, 68, 92, .08); }
.todo-sched-save { background: #0073ea; color: white; }
.todo-sched-save:hover { background: #0060b9; }
