.todo-panel {
  border-top: 1px solid var(--border);
  max-height: 24%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: rgba(12, 12, 20, 0.16);
}
.todo-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  flex-shrink: 0;
}
.todo-panel-heading { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.todo-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.todo-count { font-size: 11px; color: var(--text-dim); }
.todo-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.todo-expand:hover { border-color: var(--border-hi); color: var(--text); }
.todo-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.todo-workspace-progress { display: none; }
.task-workspace-shell {
  width: clamp(340px, 32vw, 460px);
  flex: 0 0 clamp(340px, 32vw, 460px);
  min-width: 0;
  overflow: hidden;
  background: var(--surface2);
  border-right: 1px solid var(--border);
}
.task-workspace-shell[hidden] { display: none; }
.task-workspace-shell .todo-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  border-top: 0;
  background: var(--surface2);
}
.task-workspace-shell .todo-panel-header { padding: 18px 18px 10px; }
.task-workspace-shell .todo-panel-title { color: var(--text); font-size: 13px; }
.task-workspace-shell .todo-list { flex: 1; padding: 2px 14px 12px; }
.task-workspace-shell .todo-add { padding: 0 14px 18px; }
.task-workspace-shell .todo-workspace-progress {
  display: grid;
  gap: 12px;
  margin: 0 14px 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.todo-progress-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}
.todo-progress-summary strong { color: var(--text); font-weight: 600; }
.todo-progress-separator { color: var(--text-dim); }
.todo-goal-row { display: flex; align-items: end; gap: 8px; }
.todo-goal-field { display: grid; gap: 5px; min-width: 0; flex: 1; }
.todo-goal-field label { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.todo-goal-input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 8px;
  outline: none;
}
.todo-goal-input:focus { border-color: var(--accent); }
.todo-goal-save, .todo-goal-clear {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
}
.todo-goal-save:hover, .todo-goal-clear:hover { border-color: var(--accent); color: var(--text); }
.todo-goal-clear[hidden] { display: none; }
.todo-goal-progress { display: grid; gap: 6px; }
.todo-goal-progress[hidden] { display: none; }
.todo-goal-progress label { font-size: 11.5px; color: var(--text-muted); }
.todo-goal-progress progress {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--accent);
  accent-color: var(--accent);
}
.todo-goal-progress progress::-webkit-progress-bar { background: var(--surface2); border-radius: 99px; }
.todo-goal-progress progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.todo-goal-progress progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.todo-goal-status { min-height: 16px; color: var(--text-dim); font-size: 11.5px; line-height: 1.4; }
.todo-goal-status.error { color: var(--error-text); }
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 0 8px 6px;
  min-height: 0;
}
.todo-list::-webkit-scrollbar { width: 4px; }
.todo-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.todo-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto auto auto auto;
  align-items: start;
  gap: 6px;
  padding: 6px 4px;
  border-radius: 7px;
}
.todo-item.subtask { margin-left: 18px; }
.todo-item:hover { background: var(--surface2); }
.todo-check { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; }
.todo-text {
  min-width: 0;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.todo-item.completed .todo-text { color: var(--text-dim); text-decoration: line-through; }
.todo-item.focus-linked { background: var(--accent-subtle); box-shadow: inset 2px 0 0 var(--accent); }
.todo-focus-marker {
  display: inline-flex;
  align-items: center;
  margin-left: 7px;
  padding: 1px 5px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.03em;
  text-decoration: none;
  vertical-align: 1px;
}
@keyframes todo-confirmed-complete {
  0% { background: var(--accent-subtle); transform: translateX(0); }
  45% { background: var(--green-dim); transform: translateX(2px); }
  100% { background: transparent; transform: translateX(0); }
}
@keyframes todo-goal-hit {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  40% { box-shadow: inset 0 0 0 2px var(--accent-border); }
}
.todo-item.just-completed { animation: todo-confirmed-complete 420ms ease-out both; }
.todo-panel.goal-hit { animation: todo-goal-hit 650ms ease-out; }
.todo-subtask-count {
  color: var(--text-dim);
  font-size: 11px;
  margin-left: 6px;
  white-space: nowrap;
  text-decoration: none;
}
.todo-action {
  opacity: 0.72;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 1px 3px;
  border-radius: 4px;
  transition: opacity 0.15s, color 0.15s;
}
.todo-item:hover .todo-action,
.todo-item:focus-within .todo-action,
.todo-action:focus-visible { opacity: 1; }
.todo-action:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.todo-action:hover { color: var(--text); }
.todo-action.danger:hover { color: var(--error-text); }
.duration-popover {
  position: fixed;
  z-index: 1000;
  width: min(260px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  box-shadow: var(--shadow-menu);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.duration-popover-title {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.duration-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.duration-preset, .duration-start {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  padding: 7px 8px;
  cursor: pointer;
}
.duration-preset:hover, .duration-start:hover { border-color: var(--accent); }
.duration-custom { display: flex; gap: 6px; align-items: center; }
.duration-custom input {
  min-width: 0;
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 7px 8px;
  outline: none;
}
.duration-custom input:focus { border-color: var(--accent); }
.duration-error { min-height: 16px; color: var(--error-text); font-size: 11.5px; line-height: 1.35; }
.todo-edit-input, .todo-add-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  padding: 6px 8px;
  outline: none;
}
.todo-edit-input:focus, .todo-add-input:focus { border-color: var(--accent); }
.todo-add { padding: 0 8px 10px; flex-shrink: 0; }
.todo-subtask-add { padding: 0 4px 4px 40px; }
.todo-empty { padding: 8px 4px; font-size: 12px; color: var(--text-dim); line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .todo-item.just-completed, .todo-panel.goal-hit { animation: none; }
  .todo-expand { transition: none; }
}

@media (max-width: 900px) {
  .task-workspace-shell {
    position: fixed;
    inset: 0;
    z-index: 210;
    width: 100%;
    height: 100%;
    max-width: none;
    background: var(--surface2);
    border-right: 0;
  }
  .task-workspace-shell .todo-panel { max-width: none; }
  .task-workspace-shell .todo-panel-header { padding-top: max(18px, env(safe-area-inset-top)); }
  .task-workspace-shell .todo-list { padding-bottom: 16px; }
  .task-workspace-shell .todo-add { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}

@media (max-width: 640px) {
  .task-workspace-shell .todo-panel-header { padding-left: 14px; padding-right: 14px; }
  .task-workspace-shell .todo-workspace-progress { margin-left: 10px; margin-right: 10px; }
  .task-workspace-shell .todo-list { padding-left: 10px; padding-right: 10px; }
  .todo-goal-row { align-items: stretch; flex-wrap: wrap; }
  .todo-goal-field { flex-basis: 100%; }
}
