/* ============================================================
   Meridian — To Do
   ============================================================ */

.todo-app { flex: 1; min-width: 0; display: grid; grid-template-columns: 264px minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); height: 100%; }

/* ============================= Sidebar ============================= */
.todo-side {
  background: var(--surface-0); border-right: 1px solid var(--line);
  padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.todo-me { display: flex; align-items: center; gap: 11px; padding: 6px 8px 12px; }
.todo-me-name { font-size: 13.5px; font-weight: 700; }
.todo-me-mail { font-size: 11.5px; color: var(--ink-3); }

.todo-nav {
  display: flex; align-items: center; gap: 11px; width: 100%;
  min-height: 38px; padding: 0 10px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 570; color: var(--ink-2); text-align: left;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.todo-nav:hover { background: var(--surface-hover); color: var(--ink-1); }
.todo-nav.is-active { background: var(--surface-active); color: var(--ink-1); font-weight: 680; }
.todo-nav-ico { display: flex; width: 20px; }
.tni-orange { color: var(--cat-orange); } .tni-gold { color: var(--cat-gold); }
.tni-blue { color: var(--cat-blue); } .tni-teal { color: var(--cat-teal); }
.todo-nav-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-nav-count { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 640; }
.todo-lists-title { padding: 10px 10px 2px; }
.todo-newlist {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-top: 2px;
  font-size: 12.5px; font-weight: 620; color: var(--ink-3); border-radius: var(--r-sm); border: 1.5px dashed var(--line-strong);
  justify-content: center; transition: all var(--t-fast) var(--ease);
}
.todo-newlist:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-softer); }

/* ============================= Main ============================= */
.todo-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface-1); }
.todo-head { padding: 20px 26px 10px; flex: none; }
.todo-head-row { display: flex; align-items: center; gap: 12px; }
.todo-head-ico {
  width: 42px; height: 42px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center;
  color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--surface-1));
}
.todo-title { font-size: 22px; font-weight: 750; margin: 0; letter-spacing: -.015em; }
.todo-head-date { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.todo-sub { font-size: 13px; color: var(--ink-3); margin: 6px 0 0 54px; }

.todo-add {
  display: flex; align-items: center; gap: 10px; margin: 8px 26px 4px;
  background: var(--surface-sunken); border: 1px solid transparent; border-radius: var(--r-md);
  padding: 4px 12px 4px 6px; min-height: 46px; flex: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.todo-add:focus-within { background: var(--surface-1); border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-softer); }
.todo-add-circle {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); background: var(--accent-soft); flex: none;
}
.todo-add input { flex: 1; border: 0; background: none; font-size: 14px; padding: 8px 0; min-width: 0; }
.todo-add input:focus { outline: none; }
.todo-add input::placeholder { color: var(--ink-4); }
.todo-add-quick { display: flex; gap: 4px; flex: none; }
.taq {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 620; color: var(--ink-3);
  transition: all var(--t-fast) var(--ease);
}
.taq:hover { background: var(--surface-hover); color: var(--ink-1); }
.taq.is-on { background: var(--accent-soft); color: var(--accent); }

.todo-body { flex: 1; overflow-y: auto; padding: 10px 26px 40px; min-height: 0; }

.todo-group { margin-bottom: 10px; }
.todo-group-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 4px 6px;
}
.todo-group.is-late .todo-group-label { color: var(--danger); }

/* ---- task rows ---- */
.task {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 10px 11px 8px; border-radius: var(--r-md); margin-bottom: 2px;
  border: 1px solid transparent; position: relative;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  animation: riseIn var(--t-med) var(--ease);
}
.task:hover { background: var(--surface-hover); }
.task:focus-visible { box-shadow: var(--focus-ring); }
.task.is-open { background: var(--accent-softer); border-color: var(--accent-line); }
.task.is-done { opacity: .62; }
.task.is-done .task-title { text-decoration: line-through; text-decoration-color: var(--ink-3); text-decoration-thickness: 1.5px; }

.task-check {
  width: 22px; height: 22px; border-radius: 50%; flex: none; margin-top: 1px;
  border: 2px solid var(--ink-4); background: transparent; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-med) var(--ease);
}
.task-check:hover { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-softer); }
.task-check:active { transform: scale(.88); }
.task-check.is-on { background: var(--accent); border-color: var(--accent); animation: checkPop var(--t-med) var(--ease); }
.task-check.xs { width: 18px; height: 18px; margin-top: 2px; }

.task-main { flex: 1; min-width: 0; cursor: default; }
.task-title { font-size: 14px; font-weight: 590; color: var(--ink-1); line-height: 1.4; overflow-wrap: break-word; }
.task-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.task-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 620; color: var(--ink-3);
  padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-sunken);
}
.task-chip .icon { width: 11px; height: 11px; }
.task-chip.due.is-today { background: var(--accent-soft); color: var(--accent); }
.task-chip.due.is-overdue { background: var(--danger-soft); color: var(--danger); }
.task-chip.due.is-later { background: var(--surface-sunken); }
.task-steps-bar { height: 3px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; max-width: 220px; }
.task-steps-bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #9b5cff)); transition: width var(--t-slow) var(--ease); }

.task-star { width: 28px; height: 28px; border-radius: var(--r-sm); color: var(--ink-4); display: inline-flex; align-items: center; justify-content: center; flex: none; opacity: 0; transition: all var(--t-fast) var(--ease); }
.task:hover .task-star, .task-star.is-on { opacity: 1; }
.task-star:hover { color: var(--cat-gold); background: var(--surface-active); }
.task-star.is-on { color: var(--cat-gold); }
.task-star.is-on .icon { fill: currentColor; }
.task-more { width: 28px; height: 28px; border-radius: var(--r-sm); color: var(--ink-4); display: inline-flex; align-items: center; justify-content: center; flex: none; opacity: 0; transition: opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.task:hover .task-more, .task.is-open .task-more { opacity: 1; }
.task-more:hover { background: var(--surface-active); color: var(--ink-1); }

.todo-completed-toggle {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px;
  font-size: 13px; font-weight: 680; color: var(--ink-3); padding: 6px 10px; border-radius: var(--r-sm);
}
.todo-completed-toggle:hover { background: var(--surface-hover); color: var(--ink-1); }
.todo-ct-chev { transition: transform var(--t-med) var(--ease); }
.todo-ct-chev.is-open { transform: rotate(90deg); }
.todo-completed { margin-top: 4px; animation: riseIn var(--t-med) var(--ease); }

.todo-suggest { margin-top: 26px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.todo-suggest-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 720; color: var(--ink-3); margin-bottom: 6px; }
.todo-suggest-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--t-fast) var(--ease);
}
.todo-suggest-row:hover { background: var(--surface-hover); }
.todo-suggest-row .icon { color: var(--accent); }
.tsr-name { flex: 1; font-size: 13px; color: var(--ink-2); }
.tsr-due { font-size: 11.5px; color: var(--ink-4); }

.confetti {
  position: fixed; z-index: 250; width: 7px; height: 7px; border-radius: 2px; pointer-events: none;
  animation: confettiFall var(--t-lazy) var(--ease) forwards;
}

/* ============================= Detail panel ============================= */
.todo-detail {
  border-left: 1px solid var(--line); background: var(--surface-1);
  display: none; flex-direction: column; min-height: 0;
}
.todo-detail.has-task { display: flex; animation: slideLeft var(--t-med) var(--ease); }
@keyframes slideLeft { from { opacity: 0; transform: translateX(14px); } }

.td-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 12px; }
.td-title {
  flex: 1; border: 0; background: none; font-size: 16.5px; font-weight: 680; color: var(--ink-1);
  padding: 4px 8px; border-radius: var(--r-sm); min-width: 0;
}
.td-title:hover { background: var(--surface-hover); }
.td-title:focus { outline: none; background: var(--surface-sunken); box-shadow: 0 0 0 2px var(--accent-line); }

.td-body { flex: 1; overflow-y: auto; padding: 4px 18px 24px; display: flex; flex-direction: column; gap: 16px; }
.td-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.td-q {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: var(--r-pill); font-size: 12.5px; font-weight: 620; color: var(--ink-2);
  border: 1px solid var(--line); transition: all var(--t-fast) var(--ease);
}
.td-q:hover { background: var(--surface-hover); color: var(--ink-1); }
.td-q.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.td-steps { background: var(--surface-sunken); border-radius: var(--r-md); padding: 12px 12px 6px; }
.td-steps-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.td-steps-count { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.td-step { display: flex; align-items: center; gap: 10px; padding: 5px 2px; border-radius: var(--r-sm); }
.td-step-title { flex: 1; font-size: 13.5px; color: var(--ink-1); }
.td-step-title.is-done { text-decoration: line-through; color: var(--ink-3); }
.td-step-x { width: 22px; height: 22px; border-radius: var(--r-xs); color: var(--ink-4); display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.td-step:hover .td-step-x { opacity: 1; }
.td-step-x:hover { background: var(--surface-active); color: var(--danger); }
.td-step-add { display: flex; align-items: center; gap: 9px; padding: 7px 2px; color: var(--ink-3); }
.td-step-add input { border: 0; background: none; font-size: 13.5px; flex: 1; color: var(--ink-1); }
.td-step-add input:focus { outline: none; }

.td-fields { display: flex; flex-direction: column; }
.td-field {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.td-field-ico { color: var(--ink-3); display: flex; }
.td-field-name { font-size: 13px; font-weight: 590; color: var(--ink-2); width: 84px; flex: none; }
.td-field-ctrl { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.td-field-ctrl input, .td-field-ctrl .select { width: auto; min-width: 118px; padding: 5px 10px; font-size: 12.5px; background: transparent; border-color: transparent; }
.td-field-ctrl input:hover, .td-field-ctrl .select:hover { border-color: var(--line-strong); }
.td-field-ctrl input:focus, .td-field-ctrl .select:focus { background: var(--surface-1); }

.td-notes {
  border: 0; background: var(--surface-sunken); border-radius: var(--r-md);
  padding: 12px 14px; font-size: 13.5px; resize: vertical; min-height: 90px; color: var(--ink-1);
}
.td-notes:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-line); }
.td-foot { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--ink-4); }
.td-completed-tag { color: var(--success); font-weight: 650; }

/* ============================= Responsive ============================= */
@media (max-width: 1280px) {
  .todo-app { grid-template-columns: 232px minmax(0, 1fr); }
  .todo-detail { position: absolute; inset: 0 0 0 auto; width: min(360px, 92vw); z-index: 18; box-shadow: var(--shadow-3); }
}
@media (max-width: 1080px) {
  .todo-app { grid-template-columns: 1fr; }
  .todo-side { position: absolute; inset: 0 auto 0 0; width: 272px; z-index: 22; transform: translateX(-102%); transition: transform var(--t-slow) var(--ease); box-shadow: var(--shadow-3); }
  .app[data-nav-open="1"] .todo-side { transform: none; }
}
@media (max-width: 640px) {
  .todo-head { padding: 14px 16px 8px; }
  .todo-add { margin: 6px 16px 4px; }
  .todo-body { padding: 8px 16px 32px; }
  .todo-add-quick { display: none; }
  .todo-head-date { display: none; }
}
